本文整理匯總了PHP中plugin::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP plugin::delete方法的具體用法?PHP plugin::delete怎麽用?PHP plugin::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plugin
的用法示例。
在下文中一共展示了plugin::delete方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: generate
/**
* Generate the plugin.
*/
public function generate()
{
$name = $this->getName();
if ($this->plugin->has($name)) {
if ($this->force) {
$this->plugin->delete($name);
} else {
$this->console->error("plugin [{$name}] already exist!");
return;
}
}
$this->generateFolders();
$this->generateFiles();
if (!$this->plain) {
$this->generateResources();
}
$this->console->info("plugin [{$name}] created successfully.");
}
示例2: delete
/**
* Delete plugin from Plugin Folder
*
* @param string plugin name/folder
*/
public static function delete($folder = NULL)
{
if ($folder) {
if (is_dir(PLUGINPATH . $folder)) {
// First Delete Files Recursively
$files = scandir(PLUGINPATH . $folder);
array_shift($files);
// remove '.' from array
array_shift($files);
// remove '..' from array
foreach ($files as $file) {
$file = PLUGINPATH . $folder . "/" . $file;
if (is_dir($file)) {
plugin::delete($file);
try {
rmdir($file);
} catch (Kohana_Database_Exception $e) {
// Log exceptions
Kohana::log('error', 'Caught exception: ' . $e->getMessage());
}
} else {
try {
unlink($file);
} catch (Kohana_Database_Exception $e) {
// Log exceptions
Kohana::log('error', 'Caught exception: ' . $e->getMessage());
}
}
}
}
}
}