*/
function loadModuleConfig($cfg)
{
+
+ $proj = $cfg['project'];
+ $rootDir = realpath(dirname($_SERVER["SCRIPT_FILENAME"]));
+
+ $cls = $proj.'_Config';
+ if (file_exists($rootDir . '/'.str_replace('_','/', $cls). '.php')) {
+ require_once str_replace('_','/', $cls). '.php';
+ $c = new $cls();
+ if (method_exists($c,'init')) {
+ $cfg = $c->init($this,$cfg);
+ }
+ }
if (empty($cfg['enable'])) {
return $cfg;
}
- $proj = $cfg['project'];
- $rootDir = realpath(dirname($_SERVER["SCRIPT_FILENAME"]));
-
foreach(explode(',',$cfg['enable']) as $m) {
$cls = $proj.'_'. $m . '_Config';
function _configDataObjectsCache()
{
// cli works under different users... it may cause problems..
+
$this->debug(__METHOD__);
+
+ if ($this->database === false) {
+ return;
+ }
+
if (function_exists('posix_getpwuid')) {
$uinfo = posix_getpwuid( posix_getuid () );
$user = $uinfo['name'];
$iniCache = ini_get('session.save_path') .'/' .
- 'dbcfg-' . $user . '/'. str_replace('/', '_', $this->project) ;
+ 'dbcfg-' . $user . '/'. str_replace('/', '_', $this->project);
if ($this->appNameShort) {
if ($this->version) {
$iniCache .= '.' . $this->version;
}
- if ($this->database === false) {
- return;
- }
+
$dburl = parse_url($this->database);
if (!empty($dburl['path'])) {
$this->dataObjectsOriginalIni = $this->DB_DataObject[$dbini];
///print_r($this->DB_DataObject);exit;
}
- //
-
-
-
+
+
$this->DB_DataObject[$dbini] = $iniCache;
// we now have the configuration file name..
$iniCache = $this->DB_DataObject[$dbini];
$this->debug('generateDataobjectsCache:' .dirname($iniCache).'/*.ini');
- if ($force && file_exists($iniCache)) {
-
+
+ $replace = array();
+
+ if (file_exists($iniCache)) {
$files = glob(dirname($iniCache).'/*.ini');
foreach($files as $f) {
- unlink($f);
+ $replace[$f] = md5(file_get_contents($f)); // hash it..
+
}
- clearstatcache();
}
$this->debug('generateDataobjectsCache: DONE ini delete');
$generator->start();
$this->debug('generateDataobjectsCache: done generator');
- HTML_FlexyFramework_Generator::writeCache($iniCacheTmp, $iniCache);
+ HTML_FlexyFramework_Generator::writeCache($iniCacheTmp, $iniCache, $replace);
// reset the cache to the correct lcoation.
$this->DB_DataObject[$dbini] = $iniCache;
/* have I been initialized */
- if (get_magic_quotes_gpc() && !$this->cli) {
+ if (version_compare(PHP_VERSION, '7.0.0') < 0 && get_magic_quotes_gpc() && !$this->cli) {
$this->fatalError(
"magic quotes is enabled add the line<BR>
php_value magic_quotes_gpc 0<BR>
<BR> ".$err->toString());
}
$res = $err->query("SELECT @@global.read_only as ro");
- $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
- if (!empty($row['ro'])) {
+
+ $row = is_a($res, 'DB_Error') ? false : $res->fetchRow(DB_FETCHMODE_ASSOC);
+ if (!$row || (!empty($row['ro']) && empty($options['skip-read-only-check']))) {
$this->fatalError("Database is configured to be read-only - please check database<BR> ".$err->toString());
}
// reset dont die!
}
$startRequest = $request;
- $request =@ array_shift(explode('?', $request));
+ $ra = explode('?', $request);
+ $request = array_shift($ra);
$this->debug("INPUT REQUEST $request<BR>");
if (!$isRedirect) {
// check that request forms contains baseurl????
}
- $request_array=explode("/",$request);
+ $request_array = explode("/",$request);
$original_request_array = $request_array;
$sub_request_array = array();
$l = count($request_array)-1;
return true;
}
// file exists, but process might not be the same..
- $name = array_pop(explode('_', get_class($class)));
+ $ea = explode('_', get_class($class));
+ $name = array_pop($ea);
$cmd = file_get_contents('/proc/' . $oldpid.'/cmdline');
if (!preg_match('/php/i',$cmd) || !preg_match('/'.$name.'/i',$cmd)) {
file_put_contents($lock, getmypid());