array(
        'cluster_identifier' => 'Cluster identifier to fetch seo data for',
        'output_file' => 'File to write data to',
        'application_identifier' => 'Applicationi identifier to fetch seo data for',
        'fields' => 'Fields to be fetched, comma separated (default: "cluster_identifier, application_identifier, keyword, nb_results") - you can use format a=b to save data with label b instead of field name',
        'header' => 'Should header be outputted (default: true)',
        'delimiter' => 'Delimiter to be used when outputting CSV file',
        'enclosure' => 'Enclosure to be used when outputting CSV file',
    )
);

$script->initialize();
$cli = eZCLI::instance();

try {
    $options = parseOptions($options);
} catch (Exception $e) {
    $cli->error($e->getMessage());
    $script->shutdown(1);
}

$db = MMDB::instance();

$results = fetchSeoResults($db, $options['cluster_identifier'], $options['fields'], $options['application_identifier']);
$resultsCount = count($results);

if ($resultsCount == 0) {
    $cli->error(sprintf('No results found'));
    $script->shutdown(0);
}
$cli->output(sprintf('Found %d results, saving them at %s', $resultsCount, $options['output_file']));
예제 #2
0
 * @copyright	Spoonlabs
 * @version		$Revision: 5362 $
 * @author		Aleksandar Ruzicic <*****@*****.**>
 */
if (PHP_SAPI != 'cli') {
    cronjob_error('This script must be run from command line.');
}
$defaultOptions = array('task' => false, 'touch' => false, 'list' => false, 'plugin' => null, 'help' => null);
$argv = $_SERVER['argv'];
$argc = $_SERVER['argc'];
if ($argc < 2) {
    cronjob_error('ERROR: Insufficient arguments. Type --help for usage info.');
}
define('VIVVO_CRONJOB_MODE', true);
require_once dirname(dirname(dirname(__FILE__))) . '/conf.php';
$options = parseOptions($argc, $argv, $defaultOptions);
if ($options['help']) {
    help();
    exit;
}
if ($options['task']) {
    action_task($options);
} elseif ($options['list']) {
    action_list($options);
} elseif ($options['touch']) {
    action_touch($options);
} else {
    cronjob_error('ERROR: Required arguments missing. Type --help for usage info.');
}
/**
 * Handles cronjob.php --task=<task_name> [--plugin=<plugin_name>]
예제 #3
0
            if (Filecache::has($cache_filename, $lifetime)) {
                // The cache has our file, get the full filepath
                $cached_image = Filecache::getPath($cache_filename);
                return Resp::inline($cached_image, basename($image), $lifetime);
            } else {
                // File is not cached, lets get a path
                $cache_image_path = Filecache::getPath($cache_filename);
                $imwg = Imwg::open($image);
                parseOptions($imwg, $opt);
                $imwg->save($cache_image_path);
                return Resp::inline($cache_image_path, basename($image), $lifetime);
            }
        } else {
            // caching is disabled
            $imwg = Imwg::open($image);
            parseOptions($imwg, $opt);
            return $imwg->display();
            #$imwg->display();
            #exit();
        }
    }
    // No config file
    // Check if the image exists
    if (File::exists($image)) {
        return Resp::inline($image);
    }
    // No config and
    // no image found
    return Response::error('404');
});
/**
예제 #4
0
if (PHP_SAPI != 'cli') {
    exit("This is command line cronjob.");
}
//processing args
$args = $_SERVER['argv'];
$num_args = $_SERVER['argc'];
/**
 * Pass like
 * php example/cronjob_workshop_worker.php --worker=manager --time-limit=2032 --set-time-limit=0 --full-lock=true
 */
$defaultOptions = array('base-config' => false, 'worker' => false, 'full-lock' => false, 'full-lock-warning-time' => 60 * 60, 'time-limit' => 3 * 60, 'allowed-attempts' => 100, 'set-time-limit' => 0);
if ($num_args < 2) {
    help();
    exit;
}
$options = parseOptions($num_args, $args, $defaultOptions);
require_once $options['base-config'];
//Setting environment
error_reporting($config['env']['error_reporting']);
set_time_limit($options['set-time-limit']);
if (!empty($config['env']['date_default_timezone_set'])) {
    date_default_timezone_set($config['env']['date_default_timezone_set']);
}
set_include_path(implode(PATH_SEPARATOR, array(dirname(dirname(__FILE__)) . '/lib', get_include_path())));
$fullLock = $options['full-lock'];
$fullLock = $fullLock ? "lock_full_{$worker_name}" : null;
$fullLockWarningTime = $options['full-lock-warning-time'];
$allowedAttempts = $options['allowed-attempts'];
$limit_time = $options['time-limit'];
//include required classes
require_once "Edo/Event/Engine/Factory.php";
예제 #5
0
    if ($num > 0) {
        $num = 80 - $num - $len;
        for ($i = 0; $i < $num; $i++) {
            print $seperator;
        }
    }
    print "\n";
}
// end func printSeperator
if (!isset($argc) || !isset($argv)) {
    // redirect to the web gui
    // or maybe die("This is the command line interface, use php -f cli.php to run it! Open index.php for the web interface."); ?
    header('Location: GUI/index.php');
    exit(0);
}
list($options, $error) = parseOptions($argc, $argv);
if (!is_null($error) || empty($options) || isset($options['help'])) {
    // some sort of trouble or help output requested
    if (!is_null($error)) {
        printf("\n");
        printf("Error: %s\n", $error);
    }
    printHelp($argv);
} else {
    print "\n";
    if (!empty($options['files'])) {
        foreach ($options['files'] as $k => $file) {
            convertFile($file, isset($options['verbose']), isset($options['quiet']), isset($options['update']), isset($options['backup']), isset($options['warnings']));
        }
    }
    if (!empty($options['directories'])) {