From ff6078fd7e5faffb8d11a7a3856c510358400ea0 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 25 Jun 2020 22:53:36 +0300 Subject: [PATCH 1/2] Unified include calls --- app/app.php | 3 +++ app/controllers/api/account.php | 2 -- app/controllers/api/avatars.php | 2 -- app/controllers/api/database.php | 2 -- app/controllers/api/locale.php | 2 -- app/controllers/api/projects.php | 2 -- app/controllers/api/storage.php | 2 -- app/controllers/api/teams.php | 2 -- app/controllers/api/users.php | 2 -- app/controllers/web/console.php | 2 -- app/controllers/web/home.php | 2 -- public/index.php | 6 +++--- 12 files changed, 6 insertions(+), 23 deletions(-) diff --git a/app/app.php b/app/app.php index 49bedfed2b..bb4058b601 100644 --- a/app/app.php +++ b/app/app.php @@ -426,6 +426,9 @@ $utopia->get('/.well-known/acme-challenge') } ); +include_once __DIR__ . '/controllers/shared/api.php'; +include_once __DIR__ . '/controllers/shared/web.php'; + foreach($services as $key => $service) { include_once $services[$key]['controller']; } diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 7757990c69..3bce54eafa 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -29,8 +29,6 @@ use DeviceDetector\DeviceDetector; use GeoIp2\Database\Reader; use Utopia\Validator\ArrayList; -include_once __DIR__ . '/../shared/api.php'; - $oauthDefaultSuccess = $request->getServer('_APP_HOME').'/auth/oauth2/success'; $oauthDefaultFailure = $request->getServer('_APP_HOME').'/auth/oauth2/failure'; diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php index a4d9a9d79d..90f8ac34c8 100644 --- a/app/controllers/api/avatars.php +++ b/app/controllers/api/avatars.php @@ -18,8 +18,6 @@ use BaconQrCode\Writer; use Utopia\Config\Config; use Utopia\Validator\HexColor; -include_once __DIR__ . '/../shared/api.php'; - $types = [ 'browsers' => include __DIR__.'/../../config/avatars/browsers.php', 'credit-cards' => include __DIR__.'/../../config/avatars/credit-cards.php', diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 06c707745f..fafed2624b 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -25,8 +25,6 @@ use Appwrite\Database\Exception\Structure as StructureException; use DeviceDetector\DeviceDetector; use GeoIp2\Database\Reader; -include_once __DIR__ . '/../shared/api.php'; - $utopia->post('/v1/database/collections') ->desc('Create Collection') ->groups(['api', 'database']) diff --git a/app/controllers/api/locale.php b/app/controllers/api/locale.php index caf9de0f4a..148ee3e8e9 100644 --- a/app/controllers/api/locale.php +++ b/app/controllers/api/locale.php @@ -6,8 +6,6 @@ use Utopia\App; use Utopia\Locale\Locale; use GeoIp2\Database\Reader; -include_once __DIR__ . '/../shared/api.php'; - $utopia->get('/v1/locale') ->desc('Get User Locale') ->groups(['api', 'locale']) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index d2633985a8..3311abbd0b 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -21,8 +21,6 @@ use Appwrite\OpenSSL\OpenSSL; use Appwrite\Network\Validator\CNAME; use Cron\CronExpression; -include_once __DIR__ . '/../shared/api.php'; - $scopes = include __DIR__.'/../../../app/config/scopes.php'; $utopia->post('/v1/projects') diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index b02461626d..9a12b56048 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -23,8 +23,6 @@ use Appwrite\Storage\Compression\Algorithms\GZIP; use Appwrite\Resize\Resize; use Appwrite\OpenSSL\OpenSSL; -include_once __DIR__ . '/../shared/api.php'; - Storage::addDevice('local', new Local(APP_STORAGE_UPLOADS.'/app-'.$project->getId())); $fileLogos = [ // Based on this list @see http://stackoverflow.com/a/4212908/2299554 diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 9905508c31..67b4599b2d 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -20,8 +20,6 @@ use Appwrite\Database\Validator\Authorization; use Appwrite\Database\Exception\Duplicate; use Appwrite\Template\Template; -include_once __DIR__ . '/../shared/api.php'; - $utopia->post('/v1/teams') ->desc('Create Team') ->groups(['api', 'teams']) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index e29e40aded..d1744bf48a 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -21,8 +21,6 @@ use Appwrite\Database\Validator\UID; use DeviceDetector\DeviceDetector; use GeoIp2\Database\Reader; -include_once __DIR__ . '/../shared/api.php'; - $utopia->post('/v1/users') ->desc('Create User') ->groups(['api', 'users']) diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index 543794609a..595d36d33a 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -1,7 +1,5 @@ Date: Thu, 25 Jun 2020 23:02:26 +0300 Subject: [PATCH 2/2] Removed debuging --- public/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/index.php b/public/index.php index a80a351324..c87b14a26e 100644 --- a/public/index.php +++ b/public/index.php @@ -11,9 +11,9 @@ error_reporting(0); ini_set('display_errors', 0); -ini_set('display_errors', 1); -ini_set('display_startup_errors', 1); -error_reporting(E_ALL); +// ini_set('display_errors', 1); +// ini_set('display_startup_errors', 1); +// error_reporting(E_ALL); $path = (isset($_GET['q'])) ? explode('/', $_GET['q']) : [];