示例#1
0
 */
/**
 * Paths.php is required at minimum in order to define all path constants.
 */
require_once dirname(__FILE__) . "/../../bootstrap.php";
require_once "Omeka/Application.php";
declare (ticks=1);
// Set the command line arguments.
$options = new Zend_Console_Getopt(array('queue|q=s' => 'Name of queue (tube) to use', 'host|h=s' => 'Beanstalkd host IP', 'port|p-i' => 'Beanstalkd port'));
try {
    $options->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getUsageMessage();
    exit;
}
$application = new Omeka_Application(APPLICATION_ENV);
function handle_exception($e)
{
    _log($e, Zend_Log::ERR);
    exit(1);
}
set_exception_handler('handle_exception');
function handle_signal($signal)
{
    switch ($signal) {
        case SIGINT:
            throw new Omeka_Job_Worker_InterruptException("Caught SIGINT, shutting down.");
            break;
        default:
            break;
    }
示例#2
0
$baseDir = dirname(__FILE__);
/**
 * bootstrap.php is required at minimum in order to define all path constants.
 */
require_once "{$baseDir}/../../bootstrap.php";
require_once "{$baseDir}/../libraries/Omeka/Application.php";
// Set the command line arguments.
$options = new Zend_Console_Getopt(array('process|p=i' => 'process to run'));
try {
    $options->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getUsageMessage();
    exit;
}
// Load a core set of resources.
$application = new Omeka_Application(APPLICATION_ENV);
$application->bootstrap(array('Config', 'Db', 'Filederivatives', 'Locale', 'Logger', 'Options', 'Pluginbroker', 'Plugins', 'Jobs', 'Storage', 'Mail', 'View'));
// Get the database object.
$db = get_db();
// Get the process to run
$processId = $options->getOption('process');
$process = $db->getTable('Process')->find($processId);
// Get the user to run the process under
$processUserId = $process->user_id;
$processUser = $db->getTable('User')->find($processUserId);
Zend_Registry::get('bootstrap')->getContainer()->currentuser = $processUser;
// Get the name of the process class to run
$processClass = $process->class;
// Get the process arguments
$processArgs = $process->getArguments();
// Create a custom process object
 * @author Sylvain Machefert - Bordeaux 3
 */
// 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';