示例#1
0
 public function __construct($owner = null)
 {
     $this->execute = true;
     parent::__construct($owner);
     try {
         // Initialize command utility and load the cron table:
         $this->cmdU = new CommandUtil();
         $this->crontab = $this->cmdU->loadCrontab();
         $this->j = CrontabUtil::crontabToArray($this->crontab);
     } catch (Exception $e) {
         $this->execute = false;
     }
 }
示例#2
0
    } catch (PDOException $e) {
        RIP(installer_tr($permsError, array('{db}' => $_POST['dbName'], '{u}' => $_POST['dbUser'])) . '; ' . installer_t('cannot drop tables'));
    }
    // Now test creating a table, with the InnoDB storage engine (required!):
    try {
        $con->exec("CREATE TABLE IF NOT EXISTS `x2_test_table` (\n\t\t\t    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t    `a` varchar(10) NOT NULL,\n\t\t\t    PRIMARY KEY (`id`)) ENGINE=INNODB");
    } catch (PDOException $e) {
        RIP(installer_tr($permsError, array('{db}' => $_POST['dbName'], '{u}' => $_POST['dbUser'])) . '; ' . installer_t('the InnoDB storage engine is not available'));
    }
    $con->exec("DROP TABLE `x2_test_table`");
    ResponseUtil::respond(installer_t("Connection successful!"));
} elseif (isset($_POST['testCron'])) {
    require_once 'protected/components/util/CommandUtil.php';
    $command = new CommandUtil();
    try {
        $command->loadCrontab();
        ResponseUtil::respond(installer_t('Cron can be used on this system'));
    } catch (Exception $e) {
        if ($e->getCode() == 1) {
            RIP(installer_t('The "crontab" command does not exist on this system, so there is no way to set up cron jobs.'));
        } else {
            RIP(installer_t('There is a cron service available on this system, but PHP is running as a system user that does not have permission to use it.'));
        }
    }
}
/////////////////////////////////
// Declare Installer Functions //
/////////////////////////////////
/**
 * Collect base configuration from the default pre-install app config file
 *