public static function top_images() { require_library('TopImages'); $log = HarvestProcessLog::create(array('process_name' => 'Top Images')); $top_images = new TopImages(); $top_images->begin_process(); $top_images->top_concept_images(true); $top_images->top_concept_images(false); \Resque::enqueue('harvesting', 'CodeBridge', array('cmd' => 'denormalize_tables')); $log->finished(); }
<?php namespace php_active_record; include_once dirname(__FILE__) . "/../config/environment.php"; system("clear"); $log = HarvestProcessLog::create(array('process_name' => 'Update Downloadable Resources')); $mysqli =& $GLOBALS['mysqli_connection']; $manager = new ContentManager(); $resources = array(); $result = $mysqli->query("SELECT id FROM resources WHERE accesspoint_url!='' AND accesspoint_url IS NOT NULL AND service_type_id=" . ServiceType::find_or_create_by_translated_label("EOL Transfer Schema")->id . " AND refresh_period_hours > 0"); while ($result && ($row = $result->fetch_assoc())) { echo $row["id"] . "...\n"; $resource = Resource::find($row["id"]); if (!$resource->id) { continue; } $resources[] = $resource; } $more_resources = Resource::ready_for_harvesting(); foreach ($more_resources as $resource) { if (!$resource->accesspoint_url) { continue; } if ($resource->service_type_id != ServiceType::find_or_create_by_translated_label("EOL Transfer Schema")->id) { continue; } if (!in_array($resource, $resources)) { $resources[] = $resource; } }
<?php namespace php_active_record; include_once dirname(__FILE__) . "/../config/environment.php"; system("clear"); $log = HarvestProcessLog::create(array('process_name' => 'Update Connector Resources')); $mysqli =& $GLOBALS['mysqli_connection']; $manager = new ContentManager(); $connectors = Functions::get_files_in_dir(dirname(__FILE__) . "/connectors"); foreach ($connectors as $file) { if (!preg_match("/^(.*)\\.php\$/", $file, $arr)) { continue; } $resource = Resource::find($arr[1]); if (!@$resource->id) { continue; } if (!$resource->ready_to_update()) { continue; } // resources to skip as they are scheduled seperately if ($resource->id == 15) { continue; } // Flickr if ($resource->id == 71) { continue; } // Wikimedia Commons if ($resource->id == 80) {