Exemplo n.º 1
0
 /**
  * Uninstaller::_removeModule()
  * 
  * @return
  */
 public function _removeModule()
 {
     $this->parent->parent->logEvent($this::name_space, 'Successfully uninstalled module ' . $this->module_ns);
     if (WebApp::rmDir($this->module_dir)) {
         if (!is_dir($this->module_dir)) {
             return new ActionResult($this, '/admin/modules/uninstall/', 1, 'Uninstallation complete! Module has been removed.', B_T_SUCCESS, array('step' => 10, 'status' => 1, 'msg' => 'Uninstallation complete! Module has been removed.'));
         } else {
             $this->parent->parent->debug($this::name_space . ': Module directory still exists at "' . $this->module_dir . '"');
         }
     }
     return new ActionResult($this, '/admin/modules/uninstall/', 1, 'Failed to remove module directory, but module was still uninstalled!', B_T_WARNING, array('step' => 10, 'status' => 1, 'msg' => 'Failed to remove module directory, but module was still uninstalled!'));
 }
Exemplo n.º 2
0
 /**
  * Installer::_revertInstall()
  * 
  * @return
  */
 private function _revertInstall()
 {
     $this->parent->parent->debug($this::name_space . ': Reverting install...');
     // Include the uninstaller (lazy again)
     require_once dirname(__FILE__) . '/uninstall.php';
     $uninstaller = new Uninstaller($this->parent);
     if ($this->step === null) {
         return false;
     }
     // Fetch the module ID (if applicable) as the uninstaller needs it
     $fetch_query = $this->mySQL_r->prepare("SELECT `module_id` FROM `core_modules` WHERE `namespace`=?");
     if ($fetch_query !== false) {
         $fetch_query->bind_param('s', $this->namespace);
         $fetch_query->bind_result($MOD_ID);
         $fetch_query->execute();
         $fetch_query->store_result();
         if ($fetch_query->num_rows == 1) {
             while ($fetch_query->fetch()) {
                 $mod_id = $MOD_ID;
             }
         } else {
             $mod_id = null;
         }
         $fetch_query->free_result();
     }
     // Work out the details
     $dir = __MODULE__ . '/' . strtolower($this->namespace);
     $details = array('dir' => $dir, 'id' => $mod_id, 'ns' => $this->namespace);
     // Call the uninstall steps
     switch ($this->step) {
         case 7:
         case 6:
             $uninstaller->uninstall(3, $details);
         case 5:
             $uninstaller->uninstall(4, $details);
         case 4:
             $uninstaller->uninstall(6, $details);
         case 3:
             $uninstaller->uninstall(7, $details);
         case 2:
             $uninstaller->uninstall(8, $details);
         case 1:
             $this->parent->parent->debug($this::name_space . ': Removing "' . str_replace(__EXECDIR__, '', $this->tempModule) . '"');
             WebApp::rmDir($this->tempModule);
             break;
     }
 }
Exemplo n.º 3
0
 /**
  * Updater::_cleanUpdate()
  * 
  * @return
  */
 private function _cleanUpdate()
 {
     $this->parent->parent->logEvent($this::name_space, 'Successfully updated module ' . $this->module_ns);
     if (WebApp::rmDir($this->update_dir)) {
         $tempDir = __TEMP__ . '/' . strtolower($this->module_ns) . '.bak';
         if (WebApp::rmDir($tempDir)) {
             return new ActionResult($this, '/admin/modules/install/', 1, 'Update complete!', B_T_SUCCESS, array('step' => 11, 'status' => 1, 'msg' => 'Update complete!'));
         }
     }
     return new ActionResult($this, '/admin/modules/install/', 0, 'Failed to clean up update, but module was still updated!', B_T_WARNING, array('step' => 11, 'status' => 1, 'msg' => 'Failed to clean up update, but module was still updated!'));
 }