30 if (ini_get(
'memory_limit') !=
'-1') ini_set(
'memory_limit', -1);
31 error_reporting(E_ALL);
32 if ((php_sapi_name() !=
'cli')) {
33 trigger_error(
"You can only run this script from the command line\n", E_USER_ERROR);
36 $system_root = (isset($_SERVER[
'argv'][1])) ? $_SERVER[
'argv'][1] :
'';
37 if (empty($system_root) || !is_dir($system_root)) {
38 trigger_error(
"You need to supply the path to the System Root as the first argument\n", E_USER_ERROR);
41 $asset_id = (isset($_SERVER[
'argv'][2])) ? $_SERVER[
'argv'][2] :
'';
42 if (empty($asset_id)) {
43 trigger_error(
"You need to supply the asset id of the bulkmail job as the second argument\n", E_USER_ERROR);
46 require_once $system_root.
'/core/include/init.inc';
48 $root_user = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'root_user');
49 $GLOBALS[
'SQ_SYSTEM']->setCurrentUser($root_user);
52 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($asset_id);
53 if (is_null($asset) || (!($asset instanceof
Bulkmail_Job))) {
54 trigger_error(
"You need to provide a valid bulkmail job to process\n", E_USER_ERROR);
58 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
60 'assetid' => $asset_id,
61 'new_status' => SQ_STATUS_UNDER_CONSTRUCTION,
62 'dependants_only' => TRUE
64 if ($asset->status == SQ_STATUS_LIVE) {
65 $errors = $hh->freestyleHipo(
'hipo_job_edit_status', $vars);
69 if (!empty($errors)) {
70 echo print_r($errors, TRUE);