linux fixes (it's opposite day)

This commit is contained in:
flash 2016-02-20 12:20:58 +01:00
parent 3d4f1c3187
commit b977c8422b
4 changed files with 28 additions and 33 deletions

View file

@ -8,29 +8,22 @@
; but must EXCLUDE the .php file extension. (I recommend sticking with the bundled mysql library) ; but must EXCLUDE the .php file extension. (I recommend sticking with the bundled mysql library)
driver = mysql driver = mysql
; Use a Unix system socket (if the library supports it), doesn't work on Windows servers.
unixsocket = false
; URI to SQL server (usually localhost or 127.0.0.1) or in the case that you're using Unix sockets
; the path to the socket.
host = localhost
; Port for the SQL server, ignored if Unix sockets are used. Should be 3306.
port = 3306
; Username used to authenticate with the SQL server ; Username used to authenticate with the SQL server
username = sakura username = sakura
; Password for the same purpose ; Password for the same purpose
password = "password" password = "password"
; Database (not table) name used.
database = sakura
; Table prefix used. ; Table prefix used.
prefix = sakura_ prefix = sakura_
[dsn]
host=localhost
port=3306
dbname=sakura
; Data files relative to the root directory ; Data files relative to the root directory
[data] [data]
; JSON file containing ISO 3166 country codes ; JSON file containing ISO 3166 country codes

View file

@ -90,11 +90,11 @@ class Config
* Get a configuration value from the database. * Get a configuration value from the database.
* *
* @param string $key Configuration key. * @param string $key Configuration key.
* @param bool $returnNull Unused value, only exists to prevent explosions. * @param string $default Value that gets used when the value doesn't exist.
* *
* @return string Configuration value. * @return string Configuration value.
*/ */
public static function get($key, $returnNull = false) public static function get($key, $default = null)
{ {
// Check if the key that we're looking for exists // Check if the key that we're looking for exists
if (array_key_exists($key, self::$database)) { if (array_key_exists($key, self::$database)) {
@ -112,12 +112,11 @@ class Config
} }
} }
// Then return the value // If we fell all the way down here set the bundled default value
trigger_error( Config::set($key, $default);
'Unable to get configuration value "' . $key . '"',
E_USER_ERROR // And then return default that value
); return $default;
return null;
} }
public static function set($key, $value) public static function set($key, $value)

View file

@ -18,6 +18,6 @@ class ServeCommand extends Command
public function execute() public function execute()
{ {
exec(PHP_BINDIR . '\php -S localhost:8000 -t ' . addslashes(ROOT . 'public/') . ' ' . addslashes(ROOT . 'server.php')); exec(PHP_BINDIR . '/php -S localhost:8000 -t ' . addslashes(ROOT . 'public/') . ' ' . addslashes(ROOT . 'server.php'));
} }
} }

View file

@ -37,11 +37,14 @@ if (!@include_once ROOT . 'vendor/autoload.php') {
// Setup the autoloader // Setup the autoloader
spl_autoload_register(function ($className) { spl_autoload_register(function ($className) {
// Replace \ with /
$className = str_replace('\\', '/', $className);
// Create a throwaway count variable // Create a throwaway count variable
$i = 1; $i = 1;
// Replace the sakura namespace with the libraries directory // Replace the sakura namespace with the libraries directory
$className = str_replace('Sakura\\', 'libraries/', $className, $i); $className = str_replace('Sakura/', 'libraries/', $className, $i);
// Require the file // Require the file
require_once ROOT . $className . '.php'; require_once ROOT . $className . '.php';