本文整理汇总了PHP中make_writable函数的典型用法代码示例。如果您正苦于以下问题:PHP make_writable函数的具体用法?PHP make_writable怎么用?PHP make_writable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_writable函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_writable_dir
function create_writable_dir($dirname)
{
if (is_dir($dirname) || @sugar_mkdir($dirname, 0755)) {
$ok = make_writable($dirname);
}
if (empty($ok)) {
installLog("ERROR: Cannot create writable dir {$dirname}");
}
}
示例2: saveOverride
function saveOverride($override)
{
require_once 'install/install_utils.php';
if (!file_exists('config_override.php')) {
touch('config_override.php');
}
if (!make_writable('config_override.php') || !is_writable('config_override.php')) {
$GLOBALS['log']->fatal("Unable to write to the config_override.php file. Check the file permissions");
return;
}
$fp = sugar_fopen('config_override.php', 'w');
fwrite($fp, $override);
fclose($fp);
}
示例3: 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;
}
示例4: runCheck
//.........这里部分代码省略.........
if (!function_exists('xml_parser_create')) {
$xmlStatus = "<b><span class=stop>{$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}</span></b>";
installLog("ERROR:: {$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_XML'] . '</strong></td>
<td class="error">' . $xmlStatus . '</td>
</tr>';
} else {
installLog("XML Parsing Support Found");
}
// mbstrings
if (!function_exists('mb_strlen')) {
$mbstringStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_MBSTRING']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_MBSTRING']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_MBSTRING'] . '</strong></td>
<td class="error">' . $mbstringStatus . '</td>
</tr>';
} else {
installLog("MBString Support Found");
}
// zip
if (!class_exists('ZipArchive')) {
$zipStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_ZIP']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_ZIP']}");
} else {
installLog("ZIP Support Found");
}
// config.php
if (file_exists('./config.php') && (!make_writable('./config.php') || !is_writable('./config.php'))) {
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}");
$configStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}</span></b>";
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_CONFIG'] . '</strong></td>
<td class="error">' . $configStatus . '</td>
</tr>';
}
// custom dir
if (!make_writable('./custom')) {
$customStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_CUSTOM'] . '</strong></td>
<td class="error">' . $customStatus . '</td>
</tr>';
} else {
installLog("/custom directory and subdirectory check passed");
}
// data dir
if (!make_writable('./data') || !make_writable('./data/upload')) {
$dataStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE']}</span></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_FILES_NOT_WRITABLE']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_DATA'] . '</strong></td>
<td class="error">' . $dataStatus . '</td>
</tr><tr>
示例5: validate_siteConfig
}
$validation_errors = validate_siteConfig('b');
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('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
示例6: make_writable
// custom dir
make_writable('./custom');
// modules dir
recursive_make_writable('./modules');
// data dir
make_writable('./data');
make_writable('./data/upload');
// cache dir
make_writable('./cache/custom_fields');
make_writable('./cache/dyn_lay');
make_writable('./cache/images');
make_writable('./cache/import');
make_writable('./cache/layout');
make_writable('./cache/pdf');
make_writable('./cache/upload');
make_writable('./cache/xml');
// 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);
}
}
}
示例7: 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;
}
示例8: isset
// modules dir
if (recursive_make_writable('./modules')) {
$moduleStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
} else {
$moduleStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
$error_found = true;
}
// data dir
if (make_writable('./data') && make_writable('./data/upload')) {
$dataStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
} else {
$dataStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
$error_found = true;
}
// cache dir
if (make_writable('./cache/custom_fields') && make_writable('./cache/dyn_lay') && make_writable('./cache/images') && make_writable('./cache/import') && make_writable('./cache/layout') && make_writable('./cache/pdf') && make_writable('./cache/upload') && make_writable('./cache/xml')) {
$cacheStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
} else {
$cacheStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_NOT_WRITABLE']}</span></b>";
$error_found = true;
}
// session save dir
$temp_dir = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : "";
$session_save_path = session_save_path() === "" ? $temp_dir : session_save_path();
if (strpos($session_save_path, ";") !== FALSE) {
$session_save_path = substr($session_save_path, strpos($session_save_path, ";") + 1);
}
if (is_dir($session_save_path)) {
if (is_writable($session_save_path)) {
$sessionStatus = "<b><span class=go>{$mod_strings['LBL_CHECKSYS_OK']}</span></b>";
} else {
示例9: runCheck
//.........这里部分代码省略.........
if (!function_exists('xml_parser_create')) {
$xmlStatus = "<b><span class=stop>{$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}</span></b>";
installLog("ERROR:: {$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_XML'] . '</strong></td>
<td class="error">' . $xmlStatus . '</td>
</tr>';
} else {
installLog("XML Parsing Support Found");
}
// mbstrings
if (!function_exists('mb_strlen')) {
$mbstringStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_MBSTRING']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_MBSTRING']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_MBSTRING'] . '</strong></td>
<td class="error">' . $mbstringStatus . '</td>
</tr>';
} else {
installLog("MBString Support Found");
}
// zip
if (!class_exists('ZipArchive')) {
$zipStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_ZIP']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_ZIP']}");
} else {
installLog("ZIP Support Found");
}
// config.php
if (file_exists('./config.php') && (!make_writable('./config.php') || !is_writable('./config.php'))) {
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}");
$configStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}</span></b>";
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_CONFIG'] . '</strong></td>
<td class="error">' . $configStatus . '</td>
</tr>';
}
// config_override.php
if (file_exists('./config_override.php') && (!make_writable('./config_override.php') || !is_writable('./config_override.php'))) {
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CONFIG_OVERRIDE_NOT_WRITABLE']}");
$configStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CONFIG_OVERRIDE_NOT_WRITABLE']}</span></b>";
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_OVERRIDE_CONFIG'] . '</strong></td>
<td class="error">' . $configStatus . '</td>
</tr>';
}
// custom dir
if (!make_writable('./custom')) {
$customStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}");
$error_found = true;
$error_txt .= '
<tr>
<td><strong>' . $mod_strings['LBL_CHECKSYS_CUSTOM'] . '</strong></td>
<td class="error">' . $customStatus . '</td>
</tr>';
} else {
installLog("/custom directory and subdirectory check passed");
示例10: runCheck
//.........这里部分代码省略.........
}
// XML Parsing
if (!function_exists('xml_parser_create')) {
$xmlStatus = "<b><span class=stop>{$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}</span></b>";
installLog("ERROR:: {$mod_strings['LBL_CHECKSYS_XML_NOT_AVAILABLE']}");
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_XML'] . '</strong></p>
<p class="error">' . $xmlStatus . '</p>
';
} else {
installLog("XML Parsing Support Found");
}
// mbstrings
if (!function_exists('mb_strlen')) {
$mbstringStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_MBSTRING']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_MBSTRING']}");
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_MBSTRING'] . '</strong></p>
<p class="error">' . $mbstringStatus . '</p>
';
} else {
installLog("MBString Support Found");
}
// zip
if (!class_exists('ZipArchive')) {
$zipStatus = "<b><span class=stop>{$mod_strings['ERR_CHECKSYS_ZIP']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_ZIP']}");
} else {
installLog("ZIP Support Found");
}
// config.php
if (file_exists('./config.php') && (!make_writable('./config.php') || !is_writable('./config.php'))) {
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}");
$configStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CONFIG_NOT_WRITABLE']}</span></b>";
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_CONFIG'] . '</strong></p>
<p class="error">' . $configStatus . '</p>
';
}
// config_override.php
if (file_exists('./config_override.php') && (!make_writable('./config_override.php') || !is_writable('./config_override.php'))) {
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CONFIG_OVERRIDE_NOT_WRITABLE']}");
$configStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CONFIG_OVERRIDE_NOT_WRITABLE']}</span></b>";
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_OVERRIDE_CONFIG'] . '</strong></p>
<p class="error">' . $configStatus . '</p>
';
}
// custom dir
if (!make_writable('./custom')) {
$customStatus = "<b><span class='stop'>{$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}</font></b>";
installLog("ERROR:: {$mod_strings['ERR_CHECKSYS_CUSTOM_NOT_WRITABLE']}");
$error_found = true;
$error_txt .= '
<p><strong>' . $mod_strings['LBL_CHECKSYS_CUSTOM'] . '</strong></p>
<p class="error">' . $customStatus . '</p>
';
} else {
installLog("/custom directory and subdirectory check passed");
}
// cache dir
$cache_files[] = '';