本文整理汇总了PHP中recursive_make_writable函数的典型用法代码示例。如果您正苦于以下问题:PHP recursive_make_writable函数的具体用法?PHP recursive_make_writable怎么用?PHP recursive_make_writable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recursive_make_writable函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recursive_make_writable
function recursive_make_writable($start_file)
{
$ret_val = make_writable($start_file);
if ($ret_val && is_dir($start_file)) {
// PHP 4 alternative to scandir()
$files = array();
$dh = opendir($start_file);
$filename = readdir($dh);
while (!empty($filename)) {
if ($filename != '.' && $filename != '..' && $filename != '.svn') {
$files[] = $filename;
}
$filename = readdir($dh);
}
foreach ($files as $file) {
$ret_val = recursive_make_writable($start_file . '/' . $file);
if (!$ret_val) {
$_SESSION['unwriteable_module_files'][dirname($file)] = dirname($file);
$fnl_ret_val = false;
//break;
}
}
}
if (!$ret_val) {
$unwriteable_directory = is_dir($start_file) ? $start_file : dirname($start_file);
if ($unwriteable_directory[0] == '.') {
$unwriteable_directory = substr($unwriteable_directory, 1);
}
$_SESSION['unwriteable_module_files'][$unwriteable_directory] = $unwriteable_directory;
$_SESSION['unwriteable_module_files']['failed'] = true;
}
return $ret_val;
}
示例2: runCheck
//.........这里部分代码省略.........
$cache_files[] = '/cache/layout';
$cache_files[] = '/cache/pdf';
$cache_files[] = '/cache/upload';
$cache_files[] = '/cache/xml';
$filelist = '';
foreach ($cache_files as $c_file) {
$dirname = "." . $c_file;
$ok = false;
if (is_dir($dirname) || @sugar_mkdir($dirname, 0555)) {
$ok = make_writable($dirname);
}
if (!$ok) {
$filelist .= '<br>' . getcwd() . $c_file;
}
}
if (strlen($filelist) > 0) {
$error_found = true;
installLog("ERROR:: Some subdirectories in cache subfolder were not read/writeable:");
installLog($filelist);
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_CACHE'] . '</strong></td>
<td align="right" class="error" class="error"><b><span class="stop">' . $mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE'] . '</span></b></td>
</tr>
<tr>
<td colspan="2"><b>' . $mod_strings['LBL_CHECKSYS_FIX_FILES'] . '</b>' . $filelist . '</td>
</tr>';
} else {
installLog("/cache directory and subdirectory check passed");
}
// check modules dir
$_SESSION['unwriteable_module_files'] = array();
//if(!$writeableFiles['ret_val']) {
$passed_write = recursive_make_writable('./modules');
if (isset($_SESSION['unwriteable_module_files']['failed']) && $_SESSION['unwriteable_module_files']['failed']) {
$passed_write = false;
}
if (!$passed_write) {
$moduleStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
installLog("ERROR:: Module directories and the files under them are not writeable.");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_MODULE'] . '</strong></td>
<td align="right" class="error">' . $moduleStatus . '</td>
</tr>';
//list which module directories are not writeable, if there are less than 10
$error_txt .= '
<tr>
<td colspan="2">
<b>' . $mod_strings['LBL_CHECKSYS_FIX_MODULE_FILES'] . '</b>';
foreach ($_SESSION['unwriteable_module_files'] as $key => $file) {
if ($key != '.' && $key != 'failed') {
$error_txt .= '<br>' . $file;
}
}
$error_txt .= '
</td>
</tr>';
} else {
installLog("/module directory and subdirectory check passed");
}
// PHP.ini
$phpIniLocation = get_cfg_var("cfg_file_path");
installLog("php.ini location found. {$phpIniLocation}");
// disable form if error found
示例3: make_writable
make_writable('./config.php');
// custom dir
make_writable('./custom');
// modules dir
recursive_make_writable('./modules');
// cache dir
create_writable_dir(sugar_cached('custom_fields'));
create_writable_dir(sugar_cached('dyn_lay'));
create_writable_dir(sugar_cached('images'));
create_writable_dir(sugar_cached('modules'));
create_writable_dir(sugar_cached('layout'));
create_writable_dir(sugar_cached('pdf'));
create_writable_dir(sugar_cached('upload/import'));
create_writable_dir(sugar_cached('xml'));
create_writable_dir(sugar_cached('include/javascript'));
recursive_make_writable(sugar_cached('modules'));
// check whether we're getting this request from a command line tool
// we want to output brief messages if we're outputting to a command line tool
$cli_mode = false;
if (isset($_REQUEST['cli']) && $_REQUEST['cli'] == 'true') {
$_SESSION['cli'] = true;
// if we have errors, just shoot them back now
if (count($validation_errors) > 0) {
foreach ($validation_errors as $error) {
print $mod_strings['ERR_ERROR_GENERAL'] . "\n";
print " " . $error . "\n";
print "Exit 1\n";
exit(1);
}
}
}
示例4: make_writable
if (count($validation_errors) > 0) {
$the_file = 'siteConfig_b.php';
$si_errors = true;
}
if (!$si_errors) {
$the_file = 'performSetup.php';
}
require_once 'jssource/minify.php';
//since this is a SilentInstall we still need to make sure that
//the appropriate files are writable
// config.php
make_writable('./config.php');
// custom dir
make_writable('./custom');
// modules dir
recursive_make_writable('./modules');
// cache dir
create_writable_dir(sugar_cached('custom_fields'));
create_writable_dir(sugar_cached('dyn_lay'));
create_writable_dir(sugar_cached('images'));
create_writable_dir(sugar_cached('layout'));
create_writable_dir(sugar_cached('pdf'));
create_writable_dir(sugar_cached('upload/import'));
create_writable_dir(sugar_cached('xml'));
create_writable_dir(sugar_cached('include/javascript'));
// check whether we're getting this request from a command line tool
// we want to output brief messages if we're outputting to a command line tool
$cli_mode = false;
if (isset($_REQUEST['cli']) && $_REQUEST['cli'] == 'true') {
$_SESSION['cli'] = true;
// if we have errors, just shoot them back now
示例5: recursive_make_writable
function recursive_make_writable($start_file)
{
$ret_val = make_writable($start_file);
if ($ret_val && is_dir($start_file)) {
// PHP 4 alternative to scandir()
$files = array();
$dh = opendir($start_file);
$filename = readdir($dh);
while (!empty($filename)) {
if ($filename != '.' && $filename != '..') {
$files[] = $filename;
}
$filename = readdir($dh);
}
foreach ($files as $file) {
$ret_val = recursive_make_writable($start_file . '/' . $file);
if (!$ret_val) {
break;
}
}
}
return $ret_val;
}
示例6: runCheck
//.........这里部分代码省略.........
$cache_files[] = 'layout';
$cache_files[] = 'pdf';
$cache_files[] = 'xml';
$cache_files[] = 'include/javascript';
$filelist = '';
foreach ($cache_files as $c_file) {
$dirname = sugar_cached($c_file);
$ok = false;
if (is_dir($dirname) || @sugar_mkdir($dirname, 0555)) {
$ok = make_writable($dirname);
}
if (!$ok) {
$filelist .= '<br>' . getcwd() . "/{$dirname}";
}
}
if (strlen($filelist) > 0) {
$error_found = true;
installLog("ERROR:: Some subdirectories in cache subfolder were not read/writeable:");
installLog($filelist);
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_CACHE'] . '</strong></td>
<td align="right" class="error" class="error"><b><span class="stop">' . $mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE'] . '</span></b></td>
</tr>
<tr>
<td colspan="2"><b>' . $mod_strings['LBL_CHECKSYS_FIX_FILES'] . '</b>' . $filelist . '</td>
</tr>';
} else {
installLog("cache directory and subdirectory check passed");
}
// check modules dir
$_SESSION['unwriteable_module_files'] = array();
//if(!$writeableFiles['ret_val']) {
$passed_write = recursive_make_writable('./modules');
if (isset($_SESSION['unwriteable_module_files']['failed']) && $_SESSION['unwriteable_module_files']['failed']) {
$passed_write = false;
}
if (!$passed_write) {
$moduleStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
installLog("ERROR:: Module directories and the files under them are not writeable.");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_MODULE'] . '</strong></td>
<td align="right" class="error">' . $moduleStatus . '</td>
</tr>';
//list which module directories are not writeable, if there are less than 10
$error_txt .= '
<tr>
<td colspan="2">
<b>' . $mod_strings['LBL_CHECKSYS_FIX_MODULE_FILES'] . '</b>';
foreach ($_SESSION['unwriteable_module_files'] as $key => $file) {
if ($key != '.' && $key != 'failed') {
$error_txt .= '<br>' . $file;
}
}
$error_txt .= '
</td>
</tr>';
} else {
installLog("/module directory and subdirectory check passed");
}
// check upload dir
if (!make_writable('./upload')) {
$uploadStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
installLog("ERROR: Upload directory is not writable.");
示例7: make_writable
make_writable('./custom');
// modules dir
recursive_make_writable('./modules');
// cache dir
create_writable_dir(sugar_cached('custom_fields'));
create_writable_dir(sugar_cached('dyn_lay'));
create_writable_dir(sugar_cached('images'));
create_writable_dir(sugar_cached('modules'));
create_writable_dir(sugar_cached('layout'));
create_writable_dir(sugar_cached('pdf'));
create_writable_dir(sugar_cached('upload/import'));
create_writable_dir(sugar_cached('xml'));
create_writable_dir(sugar_cached('include/javascript'));
recursive_make_writable(sugar_cached('modules'));
// public dir
recursive_make_writable('./public');
// check whether we're getting this request from a command line tool
// we want to output brief messages if we're outputting to a command line tool
$cli_mode = false;
if (isset($_REQUEST['cli']) && $_REQUEST['cli'] == 'true') {
$_SESSION['cli'] = true;
// if we have errors, just shoot them back now
if (count($validation_errors) > 0) {
foreach ($validation_errors as $error) {
print $mod_strings['ERR_ERROR_GENERAL'] . "\n";
print " " . $error . "\n";
print "Exit 1\n";
exit(1);
}
}
}
示例8: runCheck
//.........这里部分代码省略.........
$cache_files[] = '';
$cache_files[] = 'images';
$cache_files[] = 'layout';
$cache_files[] = 'pdf';
$cache_files[] = 'xml';
$cache_files[] = 'include/javascript';
$filelist = '';
foreach ($cache_files as $c_file) {
$dirname = sugar_cached($c_file);
$ok = false;
if (is_dir($dirname) || @sugar_mkdir($dirname, 0755, true)) {
$ok = make_writable($dirname);
}
if (!$ok) {
$filelist .= '<br>' . getcwd() . "/{$dirname}";
}
}
if (strlen($filelist) > 0) {
$error_found = true;
installLog("ERROR:: Some subdirectories in cache subfolder were not read/writeable:");
installLog($filelist);
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_CACHE'] . '</strong></p>
<p align="right" class="error" class="error"><b><span class="stop">' . $mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE'] . '</span></b>
<p><b>' . $mod_strings['LBL_CHECKSYS_FIX_FILES'] . '</b>' . $filelist . '</p>
';
} else {
installLog("cache directory and subdirectory check passed");
}
// check modules dir
$_SESSION['unwriteable_module_files'] = array();
//if(!$writeableFiles['ret_val']) {
$passed_write = recursive_make_writable('./modules');
if (isset($_SESSION['unwriteable_module_files']['failed']) && $_SESSION['unwriteable_module_files']['failed']) {
$passed_write = false;
}
if (!$passed_write) {
$moduleStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
installLog("ERROR:: Module directories and the files under them are not writeable.");
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_MODULE'] . '</strong></p>
<p align="right" class="error">' . $moduleStatus . '</p>
';
//list which module directories are not writeable, if there are less than 10
$error_txt .= '
<b>' . $mod_strings['LBL_CHECKSYS_FIX_MODULE_FILES'] . '</b>';
foreach ($_SESSION['unwriteable_module_files'] as $key => $file) {
if ($key != '.' && $key != 'failed') {
$error_txt .= '<br>' . $file;
}
}
$error_txt .= '
';
} else {
installLog("/module directory and subdirectory check passed");
}
// check upload dir
if (!make_writable('./upload')) {
$uploadStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
installLog("ERROR: Upload directory is not writable.");
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_UPLOAD'] . '</strong></p>
<p align="right" class="error">' . $uploadStatus . '</p>