a tiny mvc framework for php using php-activerecord
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use __DIR__, not dirname(__FILE__).

+18 -18
+2 -2
lib/php-activerecord/examples/orders/orders.php
··· 1 1 <?php 2 - require_once dirname(__FILE__) . '/../../ActiveRecord.php'; 2 + require_once __DIR__ . '/../../ActiveRecord.php'; 3 3 4 4 // initialize ActiveRecord 5 5 ActiveRecord\Config::initialize(function($cfg) 6 6 { 7 - $cfg->set_model_directory(dirname(__FILE__) . '/models'); 7 + $cfg->set_model_directory(__DIR__ . '/models'); 8 8 $cfg->set_connections(array('development' => 'mysql://test:test@127.0.0.1/orders_test')); 9 9 10 10 // you can change the default connection with the below
+1 -1
lib/php-activerecord/examples/simple/simple.php
··· 1 1 <?php 2 - require_once dirname(__FILE__) . '/../../ActiveRecord.php'; 2 + require_once __DIR__ . '/../../ActiveRecord.php'; 3 3 4 4 // assumes a table named "books" with a pk named "id" 5 5 // see simple.sql
+1 -1
lib/php-activerecord/examples/simple/simple_with_options.php
··· 1 1 <?php 2 - require_once dirname(__FILE__) . '/../../ActiveRecord.php'; 2 + require_once __DIR__ . '/../../ActiveRecord.php'; 3 3 4 4 class Book extends ActiveRecord\Model 5 5 {
+1 -1
lib/php-activerecord/lib/Cache.php
··· 26 26 $url = parse_url($url); 27 27 $file = ucwords(Inflector::instance()->camelize($url['scheme'])); 28 28 $class = "ActiveRecord\\$file"; 29 - require_once dirname(__FILE__) . "/cache/$file.php"; 29 + require_once __DIR__ . "/cache/$file.php"; 30 30 static::$adapter = new $class($url); 31 31 } 32 32 else
+1 -1
lib/php-activerecord/lib/Connection.php
··· 121 121 { 122 122 $class = ucwords($adapter) . 'Adapter'; 123 123 $fqclass = 'ActiveRecord\\' . $class; 124 - $source = dirname(__FILE__) . "/adapters/$class.php"; 124 + $source = __DIR__ . "/adapters/$class.php"; 125 125 126 126 if (!file_exists($source)) 127 127 throw new DatabaseException("$fqclass not found!");
+1 -1
lib/php-activerecord/test/InflectorTest.php
··· 1 1 <?php 2 2 include 'helpers/config.php'; 3 - require_once dirname(__FILE__) . '/../lib/Inflector.php'; 3 + require_once __DIR__ . '/../lib/Inflector.php'; 4 4 5 5 class InflectorTest extends SnakeCase_PHPUnit_Framework_TestCase 6 6 {
+1 -1
lib/php-activerecord/test/MysqlAdapterTest.php
··· 2 2 use ActiveRecord\Column; 3 3 4 4 include 'helpers/config.php'; 5 - require_once dirname(__FILE__) . '/../lib/adapters/MysqlAdapter.php'; 5 + require_once __DIR__ . '/../lib/adapters/MysqlAdapter.php'; 6 6 7 7 class MysqlAdapterTest extends AdapterTest 8 8 {
+1 -1
lib/php-activerecord/test/OciAdapterTest.php
··· 1 1 <?php 2 2 include 'helpers/config.php'; 3 - require_once dirname(__FILE__) . '/../lib/adapters/OciAdapter.php'; 3 + require_once __DIR__ . '/../lib/adapters/OciAdapter.php'; 4 4 5 5 class OciAdapterTest extends AdapterTest 6 6 {
+1 -1
lib/php-activerecord/test/PgsqlAdapterTest.php
··· 2 2 use ActiveRecord\Column; 3 3 4 4 include 'helpers/config.php'; 5 - require_once dirname(__FILE__) . '/../lib/adapters/PgsqlAdapter.php'; 5 + require_once __DIR__ . '/../lib/adapters/PgsqlAdapter.php'; 6 6 7 7 class PgsqlAdapterTest extends AdapterTest 8 8 {
+2 -2
lib/php-activerecord/test/SqliteAdapterTest.php
··· 1 1 <?php 2 2 include 'helpers/config.php'; 3 - require_once dirname(__FILE__) . '/../lib/adapters/SqliteAdapter.php'; 3 + require_once __DIR__ . '/../lib/adapters/SqliteAdapter.php'; 4 4 5 5 class SqliteAdapterTest extends AdapterTest 6 6 { ··· 26 26 } 27 27 catch (ActiveRecord\DatabaseException $e) 28 28 { 29 - $this->assertFalse(file_exists(dirname(__FILE__) . "/" . self::InvalidDb)); 29 + $this->assertFalse(file_exists(__DIR__ . "/" . self::InvalidDb)); 30 30 } 31 31 } 32 32
+3 -3
lib/php-activerecord/test/helpers/DatabaseLoader.php
··· 78 78 { 79 79 $tables = array(); 80 80 81 - foreach (glob(dirname(__FILE__) . '/../fixtures/*.csv') as $file) 81 + foreach (glob(__DIR__ . '/../fixtures/*.csv') as $file) 82 82 { 83 83 $info = pathinfo($file); 84 84 $tables[] = $info['filename']; ··· 89 89 90 90 public function get_sql($file) 91 91 { 92 - $file = dirname(__FILE__) . "/../sql/$file.sql"; 92 + $file = __DIR__ . "/../sql/$file.sql"; 93 93 94 94 if (!file_exists($file)) 95 95 throw new Exception("File not found: $file"); ··· 99 99 100 100 public function load_fixture_data($table) 101 101 { 102 - $fp = fopen(dirname(__FILE__) . "/../fixtures/$table.csv",'r'); 102 + $fp = fopen(__DIR__ . "/../fixtures/$table.csv",'r'); 103 103 $fields = fgetcsv($fp); 104 104 105 105 if (!empty($fields))
+3 -3
lib/php-activerecord/test/helpers/config.php
··· 13 13 require_once 'SnakeCase_PHPUnit_Framework_TestCase.php'; 14 14 require_once 'DatabaseTest.php'; 15 15 require_once 'AdapterTest.php'; 16 - require_once dirname(__FILE__) . '/../../ActiveRecord.php'; 16 + require_once __DIR__ . '/../../ActiveRecord.php'; 17 17 18 18 // whether or not to run the slow non-crucial tests 19 19 $GLOBALS['slow_tests'] = false; ··· 27 27 28 28 ActiveRecord\Config::initialize(function($cfg) 29 29 { 30 - $cfg->set_model_directory(realpath(dirname(__FILE__) . '/../models')); 30 + $cfg->set_model_directory(realpath(__DIR__ . '/../models')); 31 31 $cfg->set_connections(array( 32 32 'mysql' => getenv('PHPAR_MYSQL') ?: 'mysql://test:test@127.0.0.1/test', 33 33 'pgsql' => getenv('PHPAR_PGSQL') ?: 'pgsql://test:test@127.0.0.1/test', ··· 46 46 47 47 if (is_callable('Log::singleton')) // PEAR Log installed 48 48 { 49 - $logger = Log::singleton('file', dirname(__FILE__) . '/../log/query.log','ident',array('mode' => 0664, 'timeFormat' => '%Y-%m-%d %H:%M:%S')); 49 + $logger = Log::singleton('file', __DIR__ . '/../log/query.log','ident',array('mode' => 0664, 'timeFormat' => '%Y-%m-%d %H:%M:%S')); 50 50 51 51 $cfg->set_logging(true); 52 52 $cfg->set_logger($logger);