@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | | always be used to set the mode correctly. |
| 27 | 27 | | |
| 28 | 28 | */ |
| 29 | -defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644); |
|
| 29 | +defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644); |
|
| 30 | 30 | defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666); |
| 31 | -defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755); |
|
| 32 | -defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755); |
|
| 31 | +defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755); |
|
| 32 | +defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755); |
|
| 33 | 33 | |
| 34 | 34 | /* |
| 35 | 35 | |-------------------------------------------------------------------------- |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | | These modes are used when working with fopen()/popen() |
| 40 | 40 | | |
| 41 | 41 | */ |
| 42 | -defined('FOPEN_READ') OR define('FOPEN_READ', 'rb'); |
|
| 43 | -defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b'); |
|
| 44 | -defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
|
| 42 | +defined('FOPEN_READ') OR define('FOPEN_READ', 'rb'); |
|
| 43 | +defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b'); |
|
| 44 | +defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care |
|
| 45 | 45 | defined('FOPEN_READ_WRITE_CREATE_DESCTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care |
| 46 | -defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab'); |
|
| 47 | -defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
|
| 48 | -defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
|
| 49 | -defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
|
| 46 | +defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab'); |
|
| 47 | +defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b'); |
|
| 48 | +defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb'); |
|
| 49 | +defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b'); |
|
| 50 | 50 | |
| 51 | 51 | /* |
| 52 | 52 | |-------------------------------------------------------------------------- |
@@ -73,20 +73,20 @@ discard block |
||
| 73 | 73 | | http://tldp.org/LDP/abs/html/exitcodes.html |
| 74 | 74 | | |
| 75 | 75 | */ |
| 76 | -defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors |
|
| 77 | -defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error |
|
| 78 | -defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error |
|
| 79 | -defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found |
|
| 80 | -defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class |
|
| 76 | +defined('EXIT_SUCCESS') OR define('EXIT_SUCCESS', 0); // no errors |
|
| 77 | +defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error |
|
| 78 | +defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error |
|
| 79 | +defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found |
|
| 80 | +defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class |
|
| 81 | 81 | defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member |
| 82 | -defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input |
|
| 83 | -defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error |
|
| 84 | -defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code |
|
| 85 | -defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code |
|
| 82 | +defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input |
|
| 83 | +defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error |
|
| 84 | +defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code |
|
| 85 | +defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code |
|
| 86 | 86 | |
| 87 | 87 | /***** TIMEAGO CONSTANTS *****/ |
| 88 | 88 | defined('TIMEAGO_MONTH') OR define('TIMEAGO_MONTH', strtotime('-1 month')); //1 month ago |
| 89 | -defined('TIMEAGO_WEEK') OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago |
|
| 90 | -defined('TIMEAGO_3DAY') OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago |
|
| 89 | +defined('TIMEAGO_WEEK') OR define('TIMEAGO_WEEK', strtotime('-1 week')); //1 week ago |
|
| 90 | +defined('TIMEAGO_3DAY') OR define('TIMEAGO_3DAY', strtotime('-3 day')); //3 days ago |
|
| 91 | 91 | |
| 92 | 92 | defined('USERSCRIPT_VERSION') OR define('USERSCRIPT_VERSION', '0.0.0'); //This is automatically updated on deployment. |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | chmod_files(); |
| 11 | 11 | |
| 12 | 12 | //Make sure .gitkeep file is recreated |
| 13 | - touch(getcwd() . '/application/tests/_ci_phpunit_test/.gitkeep'); |
|
| 13 | + touch(getcwd().'/application/tests/_ci_phpunit_test/.gitkeep'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /**********************************************************************************************************************/ |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | function chmod_files() { |
| 24 | - $directory = new RecursiveDirectoryIterator(getcwd() . '/application/config'); |
|
| 24 | + $directory = new RecursiveDirectoryIterator(getcwd().'/application/config'); |
|
| 25 | 25 | $flattened = new RecursiveIteratorIterator($directory); |
| 26 | 26 | |
| 27 | 27 | $files = new RegexIterator($flattened, '/^(.*\/)?(database|database_password|config|email|recaptcha|sites)\.php/'); |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | $userscriptProd = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
| 8 | 8 | |
| 9 | 9 | // Replace where needed. |
| 10 | -$userscriptProd = str_replace('https://trackr.moe/userscripts','http://manga-tracker.localhost:20180/userscripts', $userscriptProd); |
|
| 10 | +$userscriptProd = str_replace('https://trackr.moe/userscripts', 'http://manga-tracker.localhost:20180/userscripts', $userscriptProd); |
|
| 11 | 11 | |
| 12 | 12 | // Push to dev file. |
| 13 | 13 | file_put_contents('./public/userscripts/manga-tracker.dev.user.js', $userscriptProd); |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | )'); |
| 121 | 121 | }); |
| 122 | 122 | |
| 123 | -task('deploy:copy_files', function () { |
|
| 123 | +task('deploy:copy_files', function() { |
|
| 124 | 124 | $sharedPath = '{{deploy_path}}/shared'; |
| 125 | - foreach (get('copy_files') as $file) { |
|
| 125 | + foreach(get('copy_files') as $file) { |
|
| 126 | 126 | $dirname = dirname(parse($file)); |
| 127 | 127 | // Create dir of shared file |
| 128 | - runS("mkdir -p $sharedPath/" . $dirname); |
|
| 128 | + runS("mkdir -p $sharedPath/".$dirname); |
|
| 129 | 129 | // Check if shared file does not exist in shared. |
| 130 | 130 | // and file exist in release |
| 131 | - if (!test("[ -f $sharedPath/$file ]") && test("[ -f {{release_path}}/$file ]")) { |
|
| 131 | + if(!test("[ -f $sharedPath/$file ]") && test("[ -f {{release_path}}/$file ]")) { |
|
| 132 | 132 | // Copy file in shared dir if not present |
| 133 | 133 | runS("cp -rv {{release_path}}/$file $sharedPath/$file"); |
| 134 | 134 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | }); |
| 145 | 145 | |
| 146 | -task('deploy:migrate_db', function () { |
|
| 146 | +task('deploy:migrate_db', function() { |
|
| 147 | 147 | // Migration is disabled by default on production, so we need to toggle it temporally. |
| 148 | 148 | runS('( \ |
| 149 | 149 | cd {{release_path}} && \ |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | )'); |
| 154 | 154 | }); |
| 155 | 155 | |
| 156 | -task('deploy:maintenance_enable', function () { |
|
| 156 | +task('deploy:maintenance_enable', function() { |
|
| 157 | 157 | //define('MAINTENANCE', FALSE); |
| 158 | 158 | runS('( \ |
| 159 | 159 | cd {{previous_release}} && \ |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | sed -i -r "s/(\'MAINTENANCE\',) FALSE/\1 TRUE/" public/index.php \ |
| 165 | 165 | )'); |
| 166 | 166 | }); |
| 167 | -task('deploy:maintenance_disable', function () { |
|
| 167 | +task('deploy:maintenance_disable', function() { |
|
| 168 | 168 | //define('MAINTENANCE', FALSE); |
| 169 | 169 | runS('( \ |
| 170 | 170 | cd {{release_path}} && \ |