protected function removeModuleFiles() { $this->log("Remove module files to /cubi/modules folder."); $module = $this->objectName; $targetFolder = Openbiz::$app->getModulePath() . DIRECTORY_SEPARATOR . $module; recurse_delete($targetFolder); }
protected function removeModuleFiles() { $this->log("Remove module files to /cubi/modules folder."); $module = $this->name; $targetFolder = MODULE_PATH . DIRECTORY_SEPARATOR . $module; recurse_delete($targetFolder); }
function recurse_delete($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir . "/" . $object) == "dir") { recurse_delete($dir . "/" . $object); } else { unlink($dir . "/" . $object); } } } reset($objects); rmdir($dir); } }
function recurse_delete($dirPath) { if (!is_dir($dirPath)) { if (is_file($dirPath)) { unlink($dirPath); return true; } else { return false; } } if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') { $dirPath .= '/'; } $files = glob($dirPath . '*', GLOB_MARK); foreach ($files as $file) { if (is_dir($file)) { recurse_delete($file); } else { unlink($file); } } rmdir($dirPath); return true; }
/** * Called on uninstallation * * @param JAdapterInstance $adapter The object responsible for running this script */ public function uninstall(JAdapterInstance $adapter) { $db =& JFactory::getDBO(); $q = "DELETE FROM #__virtuemart_adminmenuentries WHERE `name` = 'zasilkovna';"; $db->setQuery($q); $db->query(); $vm_admin_path = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart'; recurse_delete($vm_admin_path . DS . 'models' . DS . 'zasilkovna.php'); recurse_delete($vm_admin_path . DS . 'models' . DS . 'zasilkovna_orders.php'); recurse_delete($vm_admin_path . DS . 'views' . DS . 'zasilkovna' . DS); recurse_delete($vm_admin_path . DS . 'controllers' . DS . 'zasilkovna.php'); recurse_delete(JPATH_ADMINISTRATOR . DS . 'language' . DS . 'en-GB' . DS . 'en-GB.plg_vmshipment_zasilkovna.ini'); }
/** * Unpack the cms and call own installer */ function step6() { $branch = $_GET['branch']; set_time_limit(0); $archive = new ZipArchive(); if ($archive->open($branch . '.zip') === true) { if ($archive->extractTo('./') === false) { echo 'Failed to extract ZIP File. Maybe write permissions missing?'; } else { recurse_copy('QuantumCMS-' . $branch, '.'); recurse_delete('QuantumCMS-' . $branch); runComposer(); // Delete files which are listed in install.json $installDetails = json_decode(file_get_contents('install.json')); $removeFiles = $installDetails->{'removeAfterInstall'}; foreach ($removeFiles as $file) { unlink($file); } $redirectTo = $installDetails->{'redirectTo'}; header('Location: ' . $redirectTo); echo 'Done'; } } else { echo 'ZIP-File is gone :('; } }