} } pcntl_signal(SIGINT, "handle_signal"); $application->bootstrap(array('Logger')); $host = isset($options->host) ? $options->host : '127.0.0.1'; $port = isset($options->port) ? $options->port : 11300; $pheanstalk = new Pheanstalk_Pheanstalk("{$host}:{$port}"); if (isset($options->queue) && $options->queue != 'default') { $pheanstalk->watch($options->queue)->ignore('default'); } // Reserving a job BEFORE bootstrapping the database will ensure that there are // never any MySQL timeout issues and help prevent any number of other database // usage-related problems. $pheanJob = $pheanstalk->reserve(); if (!$pheanJob) { // Timeouts can occur when reserving a job, so this must be taken // into account. No cause for alarm. echo "Beanstalk worker timed out when reserving a job."; exit(0); } $application->bootstrap(array('Config', 'Db', 'Filederivatives', 'Locale', 'Options', 'Pluginbroker', 'Plugins', 'Jobs', 'Storage', 'Mail', 'View')); // resend() must send jobs to the original queue by default. $jobDispatcher = Zend_Registry::get('job_dispatcher'); if ($options->queue) { $jobDispatcher->setQueueName($options->queue); } // Log all to stdout. $log = $application->getBootstrap()->logger; $log->addWriter(new Zend_Log_Writer_Stream('php://output')); $worker = new Omeka_Job_Worker_Beanstalk($pheanstalk, Zend_Registry::get('job_factory'), $application->getBootstrap()->db); $worker->work($pheanJob);
// Building tiles asks for more memory than usual php, maybe need to modify default setting ini_set("memory_limit", "1024M"); // max_picture_size in bytes, to prevent memory errors for big files $max_picture_size = 29900000; $collection_id = ""; if ($collection_id == "") { print "Please provide a collection_id\n"; die; } require_once dirname(dirname(dirname(__FILE__))) . '/bootstrap.php'; require_once "OpenLayersZoomPlugin.php"; require_once 'libraries/OpenLayersZoom/Zoomify/ZoomifyFileProcessor.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $application = new Omeka_Application(APPLICATION_ENV); // APP_DIR."/config/application.ini"); $application->getBootstrap()->setOptions(array('resources' => array('theme' => array('basePath' => THEME_DIR, 'webBasePath' => WEB_THEME)))); $application->initialize(); $db = get_db(); $sql = " SELECT item_id, filename\n\tFROM {$db->File} files, {$db->Item} items\n\tWHERE files.item_id = items.id "; if ($collection_id != "") { $sql .= " AND items.collection_id = {$collection_id}"; } $file_ids = $db->fetchAll($sql); $originalDir = FILES_DIR . DIRECTORY_SEPARATOR . 'original' . DIRECTORY_SEPARATOR; foreach ($file_ids as $one_id) { $filename = $originalDir . $one_id["filename"]; $computer_size = filesize($filename); $decimals = 2; $sz = 'BKMGTP'; $factor = floor((strlen($computer_size) - 1) / 3); $human_size = sprintf("%.{$decimals}f", $computer_size / pow(1024, $factor)) . @$sz[$factor];