/** * @todo Check whether $this->_mXoopsObject is ready. */ function executeInstall() { $this->_installTables(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_installModule(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_installTemplates(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_installBlocks(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_installPreferences(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_processScript(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_processReport(); return true; }
/** * execute uninstall. * * @return bool */ public function executeUninstall() { $this->_uninstallTables(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } if ($this->_mXoopsModule->get('mid') != null) { $this->_uninstallModule(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_uninstallTemplates(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_uninstallBlocks(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_uninstallPreferences(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } } $this->_processReport(); return true; }
/** * Copy from hash of oldConfig to hash of cubeConfig completely. This * member function is for the case that a module config is just clone of * the old config of the category. * * @access private * @param array $oldConfigs hash array of config items. see _getOldConfigs(). * @param array $cubeConfigs hash array of config items. see _getCubeConfigs(). * @param string $dirname A name of module directory for logging. * @see _copy() */ function _fullCopy(&$oldConfigs, &$cubeConfigs, $dirname) { foreach (array_keys($oldConfigs) as $key) { if (isset($cubeConfigs[$key])) { $this->_copy($oldConfigs[$key], $cubeConfigs[$key], $dirname); } else { $this->mLog->addError(XCube_Utils::formatMessage(_MI_XUPGRADE_ERROR_FIND_CONFIG, $key, 'user')); } } }
/** * process report. */ private function _processReport() { $dirname = $this->_mCurrentXoopsModule->get('dirname'); $constpref = '_MI_' . strtoupper($dirname); if (!$this->mLog->hasError()) { $this->mLog->add(XCube_Utils::formatString(constant($constpref . '_INSTALL_MSG_MODULE_UPDATED'), $this->_mCurrentXoopsModule->get('name'))); } else { $this->mLog->add(XCube_Utils::formatString(constant($constpref . '_INSTALL_ERROR_MODULE_UPDATED'), $this->_mCurrentXoopsModule->get('name'))); } }
/** * This method executes upgrading automatically by the diff of * xoops_version. * * 1) Uninstall all of module templates * 2) Install all of module templates * * @return bool */ function executeAutomaticUpgrade() { $this->mLog->addReport(_AD_LEGACY_MESSAGE_UPDATE_STARTED); // // Updates all of module templates // $this->_updateModuleTemplates(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } // // Update blocks. // $this->_updateBlocks(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } // // Update preferences & notifications. // $this->_updatePreferences(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } // // Update module object. // $this->saveXoopsModule($this->_mTargetXoopsModule); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } // // call back 'onUpdate' // $this->_processScript(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; } $this->_processReport(); return true; }
/** * Uninstalls a block which $block specifies. In the same time, deletes * permissions for the block. * * @param XoopsBlock $block * @param Legacy_ModuleInstallLog $log * @note FOR THE CUSTOM-INSTALLER * * @todo error handling & delete the block's template. */ function uninstallBlock(&$block, &$log) { $blockHandler =& xoops_gethandler('block'); $blockHandler->delete($block); $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UNINSTALLATION_BLOCK_SUCCESSFUL, $block->get('name'))); // // Deletes permissions // $gpermHandler =& xoops_gethandler('groupperm'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('gperm_name', 'block_read')); $criteria->add(new Criteria('gperm_itemid', $block->get('bid'))); $criteria->add(new Criteria('gperm_modid', 1)); $gpermHandler->deleteAll($criteria); }