setBaseUrl
Definition
setBaseUrl($base_url, $path)
install_drupal.inc, line 191
Description
Appends a base url directive into a file
Parameters
$base_url base url you want to set
$path path to settings file in which you want base_url
Code
<?php
function setBaseUrl($base_url, $path) {
global $bins;
chmod($path, 0777);
$fp = fopen($path, "r+");
$text = '';
$before = '';
while($line = fgets($fp)) {
$text .= $line;
if (preg_match('/NO trailing slash/', $line)) {
$before = $text;
$text = '';
}
}
fclose($fp);
$fp = fopen($path, "w");
fputs($fp, $before . '$base_url = \'' . $base_url . '\';' . $text);
fclose($fp);
chmod($path, 0444);
return TRUE;
}
?> 