本文整理汇总了PHP中filesystem::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP filesystem::delete方法的具体用法?PHP filesystem::delete怎么用?PHP filesystem::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类filesystem
的用法示例。
在下文中一共展示了filesystem::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smartstrip
}
} else {
$popup_feedback .= access_denied_box(basename($file));
}
}
echo '<script type="text/javascript" language="javascript">';
echo 'popup("' . $email_module['url'] . 'send.php?email_file=true","' . $GO_CONFIG->composer_width . '","' . $GO_CONFIG->composer_height . '");';
echo '</script>';
}
require 'listview.inc';
break;
case 'delete':
if (isset($_POST['files'])) {
for ($i = 0; $i < count($_POST['files']); $i++) {
$file = smartstrip($_POST['files'][$i]);
if (!$fs->delete($file)) {
$popup_feedback .= access_denied_box(basename($file));
}
}
}
if (isset($_POST['folders'])) {
for ($i = 0; $i < count($_POST['folders']); $i++) {
$folder = smartstrip($_POST['folders'][$i]);
if (!$fs->delete($folder)) {
$popup_feedback .= access_denied_box(basename($folder));
}
}
}
require 'listview.inc';
break;
case 'access_denied':
示例2: filesystem
$path_used = true;
break;
}
}
if (isset($path_used)) {
$feedback = '<p class="Error">' . $cms_path_already_used . '</p>';
} else {
require_once $GO_CONFIG->class_path . 'filesystem.class.inc';
$fs = new filesystem(true);
$site = $cms->get_site($site_id);
if ($site['publish_path'] != '' && file_exists($root_publish_path . $site['publish_path']) && $site['publish_path'] != $publish_path) {
$publish_dir = $root_publish_path;
$dirs = explode($GO_CONFIG->slash, $site['publish_path']);
while ($dir = array_shift($dirs)) {
$publish_dir = $publish_dir . $dir . $GO_CONFIG->slash;
$fs->delete($publish_dir);
}
}
$full_publish_path = $root_publish_path;
$dirs = explode($GO_CONFIG->slash, $publish_path);
while ($dir = array_shift($dirs)) {
$full_publish_path = $full_publish_path . $dir . $GO_CONFIG->slash;
if (!file_exists($full_publish_path)) {
@mkdir($full_publish_path);
}
if (!is_writable($full_publish_path)) {
$feedback = '<p class="Error">' . $cms_path_not_writable . ': \'' . $full_publish_path . '\'</p>';
break;
}
}
if ($full_publish_path == $root_publish_path . $publish_path) {
示例3: save
public function save()
{
if (!class_exists('DOMDocument')) {
message::set('This driver requires ' . html::anchor('http://us3.php.net/manual/en/class.domdocument.php', 'DOMDocument', array('target' => '_new')) . ' to be installed and active');
return false;
}
// This array maps the telephony returns to the telephony file
$telephonyOptions = array('cfg_root' => rtrim($this->session->get('installer.cfg_root'), '/'), 'audio_root' => rtrim($this->session->get('installer.audio_root'), '/'), 'ESLHost' => $this->session->get('installer.esl_host'), 'ESLPort' => $this->session->get('installer.esl_port'), 'ESLAuth' => $this->session->get('installer.esl_auth'));
if (!is_dir($telephonyOptions['cfg_root'])) {
message::set('Unable to access directory <pre>' . $telephonyOptions['cfg_root'] . '</pre>');
return false;
}
if (!is_dir($telephonyOptions['audio_root'])) {
message::set('Unable to access directory <pre>' . $telephonyOptions['audio_root'] . '</pre>');
return false;
}
// Write $telephonyOptions to freeswitch.php
if (!Installer_Controller::updateConfig($telephonyOptions, 'freeswitch')) {
return false;
}
// Set the driver name in telephony.php
if (!Installer_Controller::updateConfig(array('driver' => 'FreeSwitch'), 'telephony')) {
return false;
}
// Reload the new telephony options so we can use the filemap
Kohana::config_clear('freeswitch');
Kohana::config_load('freeswitch');
$filemaps = Kohana::config('freeswitch.filemap');
$notWritable = array();
foreach ($filemaps as $filemap) {
if (!filesystem::is_writable($filemap['filename'])) {
$notWritable[] = $filemap['filename'];
}
}
if (!empty($notWritable)) {
$notWritable = array_unique($notWritable);
if (empty($this->template->error)) {
message::set('Ensure the web server has write permission on these files, and SELINUX allows this action.' . '<div class="write_help">Unable to write to the following file(s):</div>' . '<div>' . arr::arrayToUL($notWritable, array(), array('class' => 'error_details', 'style' => 'text-align:left;')) . '</div>');
}
return false;
}
// Make sure that if the user changed the directory and any conflicts were found that the user
// knows these will be deleted
$existingProfiles = glob(rtrim($telephonyOptions['cfg_root'], '/') . '/sip_profiles/*.xml', GLOB_MARK);
$oldXmlFiles = array();
foreach ($filemaps as $filemap) {
if (file_exists($filemap['filename'])) {
$oldXmlFiles[] = $filemap['filename'];
}
}
$conflictXmlFiles = $this->session->get('installer.conflictXmlFiles');
foreach (array_unique(array_merge($existingProfiles, $oldXmlFiles)) as $existingFile) {
if (!in_array($existingFile, $conflictXmlFiles)) {
message::set('Conflicting configuration files will be permanently erased if you continue!');
message::set('Click continue again to proceed...', 'alert');
// This session var lets the user continue the second time around (after the warning)
$this->session->set('installer.confirm_delete', true);
return false;
}
}
// If there are conflictXmlFile in the session then the user has seen this list
// so they SHOULD be aware we are about to delete them... should
$conflictXmlFiles = $this->session->get('installer.conflictXmlFiles');
if (!empty($conflictXmlFiles) && is_array($conflictXmlFiles)) {
$confirmDelete = $this->session->get('installer.confirm_delete', false);
if (empty($confirmDelete)) {
message::set('Conflicting configuration files will be permanently erased if you continue!');
message::set('Click continue again to proceed...', 'alert');
// This session var lets the user continue the second time around (after the warning)
$this->session->set('installer.confirm_delete', true);
return false;
}
foreach ($conflictXmlFiles as $conflictXmlFile) {
if (!filesystem::delete($conflictXmlFile)) {
Kohana::log('error', 'Unable to unlink ' . $conflictXmlFile);
$unlinkErrors[] = $conflictXmlFile;
}
}
}
// If there are files that could not be deleted, inform the user
if (!empty($unlinkErrors)) {
message::set('Manually remove these files or change the file permissions.' . '<div class="write_help">Unable to delete incompatible file(s):</div>' . '<div>' . arr::arrayToUL($unlinkErrors, array(), array('class' => 'error_details', 'style' => 'text-align:left;')) . '</div>');
return false;
}
$this->session->set('installer.default_packages', kohana::config('freeswitch.default_packages'));
return true;
}