/**
  * method to intialize temporary upload table
  * @returns boolean
  */
 protected function createTempUploadTable()
 {
     if (!I2CE_Util::runSQLScript('initialize_temp_upload.sql')) {
         I2CE::raiseError("Could not initialize tempoary upload table");
         return false;
     }
     return true;
 }
 /**
  * Method called when the module is enabled for the first time.
  * @param boolean -- returns true on success. false on error.
  */
 public function action_initialize()
 {
     I2CE::raiseError("Initializing UUID Map Tables");
     if (!I2CE_Util::runSQLScript('init_uuid_table.sql')) {
         I2CE::raiseError("Could not initialize uuid table");
         return false;
     }
     return true;
 }
Ejemplo n.º 3
0
 public function action_initialize()
 {
     I2CE::raiseError("Initializing Form Tables");
     if (!I2CE_Util::runSQLScript('initialize_importexport.sql')) {
         I2CE::raiseError("Could not initialize I2CE import_export table");
         return false;
     }
     return true;
 }
 /**
  * Method called when the module is enabled for the first time.
  * @param boolean -- returns true on success. false on error.
  */
 public function action_initialize()
 {
     I2CE::raiseError("Initializing Provider Cache Table");
     if (!I2CE_Util::runSQLScript('initialize_csd_cache.sql')) {
         I2CE::raiseError("Could not initialize I2CE form tables");
         return false;
     }
     return true;
 }
 /**
  * Method called when the module is enabled for the first time.
  * @param boolean -- returns true on success. false on error.
  */
 public function action_initialize()
 {
     //load the data right now because the site isn't ready to run background processes
     I2CE::raiseError("Loading Sample Data");
     if (!I2CE_Util::runSQLScript('TrainSampleData.sql')) {
         I2CE::raiseError("Could not initialize Train Sample Data tables");
         return false;
     }
     return true;
 }
 private function addBlobValue()
 {
     $db = MDB2::singleton();
     $rows = $db->queryAll("SHOW FULL COLUMNS FROM entry WHERE Field='blob_value'");
     if (count($rows)) {
         I2CE::raiseError("entry table already has blob_value");
         return true;
     }
     I2CE::raiseError("Adding blob_value to entry tables");
     return I2CE_Util::runSQLScript('add_blob_fields.sql');
 }
Ejemplo n.º 7
0
 /**
  * Upgrade module method
  * @param string $old_vers
  * @param string $new_vers
  */
 public function upgrade($old_vers, $new_vers)
 {
     if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.11.1')) {
         if (!I2CE_Util::runSQLScript('initialize_form_store.sql')) {
             I2CE::raiseError("Could not initialize I2CE form history storage tables");
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.4.1') && !$this->upgradeFormStore()) {
         I2CE::raiseError("Could not upgrade I2CE form history storage tables");
         return false;
     }
     return true;
 }
Ejemplo n.º 8
0
 /**
  *called from the command line as
  *   --page=BackgroundPage/$script"
  * Or:
  *  --page=BackgroundPage/$db/$script
  *Where $db is the database the script is to run on.  Make sure $db is not backticked!
  *
  */
 protected function actionCommandLine($args, $req)
 {
     $req = $this->request_remainder;
     if (count($req) == 1) {
         //the first (and only) request remaineder is the script
         I2CE_Util::runSQLScript($req[0]);
     } else {
         if (count($req) == 2) {
             //the first request remainder is the DB to use the second is the script
             I2CE_Util::runSQLScript($req[1], $req[0]);
         } else {
             I2CE::raiseError("Invalid request to run sql script");
         }
     }
 }
 /**
  * Method called when the module is enabled for the first time.
  * @param boolean -- returns true on success. false on error.
  */
 public function action_initialize()
 {
     /*
     $site_module = "";
     I2CE::getConfig()->setIfIsSet( $site_module, "config/site/module" );
     $mod_factory = I2CE_ModuleFactory::instance();
     if ( $mod_factory->isEnabled( $site_module ) ) {
         //launch background import of data.
         $this->launchBackgroundPage("/BackgroundProcess/SQL/ManageSampleData.sql");
     } else {
     */
     //load the data right now because the site isn't ready to run background processes
     I2CE::raiseError("Loading Sample Data");
     if (!I2CE_Util::runSQLScript('ManageSampleData.sql')) {
         I2CE::raiseError("Could not initialize Manage Sample Data tables");
         return false;
     }
     /*
     }
     */
     return true;
 }
 /**
  * Cache the user statistics pseudo report.
  * @param boolean $drop_first
  * @param boolean $force
  * @return boolean
  */
 public function cacheUserStatistics($drop_first = false, $force = false)
 {
     if (!self::setupDB(false)) {
         return false;
     }
     $config = I2CE::getConfig()->modules->UserStatistics->cache;
     $config->volatile(true);
     $start = 0;
     $end = 0;
     $failed = 0;
     $config->setIfIsSet($start, "start");
     $config->setIfIsSet($end, "end");
     $config->setIfIsSet($failed, "failed");
     if ($force || $start == 0 || $end != 0 && $end >= $start || $failed != 0 && $failed >= $start) {
         $config->start = time();
         $res = self::$db->getOne("SHOW TABLES LIKE 'zebra__user_statistics'");
         if (!$res) {
             if (!I2CE_Util::runSQLScript('initialize_user_statistics.sql')) {
                 I2CE::raiseError("Could not initialize user statistics cache table.");
                 return false;
             }
         }
         if ($drop_first) {
             $res = self::$db->query("truncate table zebra__user_statistics");
             if (I2CE::pearError($res, "Unable to truncate user statistics cache table.")) {
                 $cache->failed = time();
                 return false;
             }
         }
         $res = self::$db->query("INSERT INTO zebra__user_statistics SELECT entry.change_type AS `change_type`, entry.date AS `date`, (SELECT CONCAT(parent_form,'|',parent_id) FROM record WHERE id = entry.record) AS `parent_id`, entry.record AS `record`, (SELECT name FROM form WHERE id = (SELECT form FROM form_field WHERE id = entry.form_field)) AS `form`, (SELECT name FROM field WHERE id = (SELECT field FROM form_field WHERE id = entry.form_field)) AS `field`, entry.string_value, entry.integer_value, entry.date_value, entry.text_value, entry.blob_value, IF(entry.who = 0, 'I2CE Admin', (SELECT CONCAT_WS( ' ', user.firstname, user.lastname ) FROM user WHERE id = entry.who)) AS `user`, IF(entry.who = 0, 'i2ce_admin', (SELECT user.username FROM user WHERE id = entry.who)) AS `username` FROM entry WHERE date > IFNULL((SELECT MAX(date) FROM zebra__user_statistics ),'0000-00-00 00:00:00')");
         if (I2CE::pearError($res, "Unable to populate user statistics cache table.")) {
             $cache->failed = time();
             return false;
         }
         $config->end = time();
         I2CE::raiseError("Updated User Statistics report at " . date('r', $config->end));
     }
     return true;
 }
Ejemplo n.º 11
0
 /**
  * Method called when the module is enabled for the first time.
  * @param boolean -- returns true on success. false on error.
  */
 public function action_initialize()
 {
     if (!I2CE_Util::runSQLScript('CREATE_formfield_mult_map_componentize.sql', null, false)) {
         //don;t use a transaction
         I2CE::raiseError("Could not install remapping SQL  function");
         return false;
     }
     return true;
 }
 /**
  * Upgrades the modules
  * @param string $old_vers
  * @param string $new_vers
  * @returns boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     I2CE::raiseError("upgrade {$old_vers} -- {$new_vers}");
     if (I2CE_Validate::checkVersion($old_vers, '<', '4.1.3.7')) {
         I2CE::raiseError("Initializing Form Task Logger");
         if (!I2CE_Util::runSQLScript('initialize_form_task_log.sql')) {
             I2CE::raiseError("Could not initialize I2CE form tables");
             return false;
         }
     }
     return true;
 }