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