public function testRelativePath() { $rp = System::relativePath("/var/www/blog/files", "/var/www/cf"); $this->assertEquals($rp, '../../cf'); $rp = System::relativePath("/home/dad/test/one", "/home/dad/test/two"); $this->assertEquals($rp, '../two'); $rp = System::relativePath("/home/test/www/one", "/home/cf/Bootstrap/www/vendor/fonts/one"); $this->assertEquals($rp, '../../../cf/Bootstrap/www/vendor/fonts/one'); $rp = System::relativePath("/home/test/www/one", "/home/test/www/one/two"); $this->assertEquals($rp, 'two'); $rp = System::relativePath("/home/dad/www/BlogMVC/CoreFramework", "/home/dad/www/cf"); $this->assertEquals($rp, '../../cf'); }
public function update() { if (Cli::getOption("a")) { $cf_dir = "\"" . realpath(CF_DIR) . "\""; } else { $cf_dir = "ROOT_DIR . \"/" . System::relativePath(System::absPath(ROOT_DIR), System::absPath(CF_DIR)) . "\""; } Cli::pinfo(" * Create paths.php"); Logger::Debug("CF dir is {$cf_dir}"); Logger::Debug("ROOT dir is " . ROOT_DIR); $content = "<?php // DO NOT MODIFY THIS FILE, IT IS GENERATED BY setup update SCRIPT\n\n"; $content .= "@define(\"ROOT_DIR\", \"" . ROOT_DIR . "\");\n"; $content .= "@define(\"CF_DIR\", {$cf_dir});\n"; file_put_contents(CONFIG_DIR . "/paths.php", $content); }