/** * Installer::_installModule() * * @param mixed $install * @return */ public function _installModule($install = null) { $this->parent->parent->debug($this::name_space . ': Finding install.php...'); if ($install === null) { $install = $this->tempModule . '/install.php'; } if (!file_exists($install)) { $this->parent->parent->debug($this::name_space . ': No install.php provided, finishing installation...'); return new ActionResult($this, '/admin/modules/install/', 0, 'Cleaning up...', B_T_SUCCESS, array('step' => 9, 'status' => 1, 'msg' => 'Cleaning up...')); } $this->parent->parent->debug($this::name_space . ': Found install.php!'); require_once $install; $this->parent->parent->debug($this::name_space . ': Calling install()...'); // Checks the function exists if (!is_callable('install')) { revertInstall($this); return new ActionResult($this, '/admin/modules/install/', 0, 'Failed to install module!', B_T_FAIL, array('status' => 0, 'msg' => 'Failed to install module!')); } // Calls the function (either returns true for success, or false for fail if (install($this)) { $this->parent->parent->debug($this::name_space . ': install() successfully executed!'); return new ActionResult($this, '/admin/modules/install/', 0, 'Cleaning up...', B_T_SUCCESS, array('status' => 1, 'msg' => 'Cleaning up...')); } else { $this->parent->parent->debug($this::name_space . ': install() did not execute successfully! Reverting...'); revertInstall($this); return new ActionResult($this, '/admin/modules/install/', 0, 'Failed to install module!', B_T_FAIL, array('status' => 0, 'msg' => 'Failed to install module!')); } }
/** * Updater::_moduleUpdater() * * @return */ private function _moduleUpdater() { $this->parent->parent->debug($this::name_space . ': Finding update.php...'); // Find the script if (file_exists($this->update_dir . '/update.php')) { $this->parent->parent->debug($this::name_space . ': Found update.php!'); // Include it require_once $this->update_dir . '/update.php'; $this->parent->parent->debug($this::name_space . ': Calling update()...'); // Execute it if (update($this)) { $this->parent->parent->debug($this::name_space . ': update() successfully executed!'); return new ActionResult($this, '/admin/modules/install/', 0, 'Cleaning up update...', B_T_FAIL, array('step' => 10, 'status' => 1, 'msg' => 'Cleaning up update...')); } else { $this->parent->parent->debug($this::name_space . ': install() did not execute successfully! Reverting...'); revertInstall($this); return new ActionResult($this, '/admin/modules/install/', 0, 'Failed to install module!', B_T_FAIL, array('status' => 0, 'msg' => 'Failed to update module!')); } } else { $this->parent->parent->debug($this::name_space . ': No update.php provided, finishing installation...'); return new ActionResult($this, '/admin/modules/install/', 0, 'Cleaning up...', B_T_FAIL, array('step' => 10, 'status' => 1, 'msg' => 'Cleaning up update...')); } }