Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stale plugin from site #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions classes/task/crawl.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,23 @@ public function execute()
echo get_string('crawl_pluginfound', 'local_sitestats', array('site' => $site->title, 'plugin' => $plugin->frankenstyle)).PHP_EOL;
}

continue;
// If there was a timeout, head over to next site.
} else if (curl_errno($ch) == CURLE_OPERATION_TIMEOUTED) {
// Output log.
echo get_string('crawl_sitetimeout', 'local_sitestats', array('site' => $site->title)).PHP_EOL;
break;
}
// Otherwise we expect that the plugin is not installed.
else {
// Output log.
echo get_string('crawl_pluginnotfound', 'local_sitestats', array('site' => $site->title, 'plugin' => $plugin->frankenstyle)).PHP_EOL;

// Remove the plugin if it was not found any more but was installed before.
if ($pluginfoundbefore_result =
$DB->get_record('local_sitestats_plugins_site', array('site' => $site->id, 'plugin' => $plugin->id))) {
$DB->delete_records('local_sitestats_plugins_site', ['id' => $pluginfoundbefore_result->id]);
}

// We expect that the plugin is not installed.
echo get_string('crawl_pluginnotfound', 'local_sitestats',
array('site' => $site->title, 'plugin' => $plugin->frankenstyle)) . PHP_EOL;
}

// Curl close
Expand Down