From dbab79fa5420c4493f3d9a4f2a922e4d770fc130 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 16 May 2020 14:28:26 +0300 Subject: [PATCH] Added yaml support --- Dockerfile | 2 +- app/controllers/api/projects.php | 2 +- app/init.php | 2 +- composer.json | 1 + src/Appwrite/Response/Response.php | 42 ++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 src/Appwrite/Response/Response.php diff --git a/Dockerfile b/Dockerfile index 25269eae0..3f662f894 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,7 +84,7 @@ RUN \ add-apt-repository ppa:certbot/certbot && \ apt-get update && \ apt-get install -y --no-install-recommends --no-install-suggests htop supervisor php$PHP_VERSION php$PHP_VERSION-fpm \ - php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom webp certbot && \ + php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom php$PHP_VERSION-yaml webp certbot && \ # Nginx echo "deb http://nginx.org/packages/mainline/ubuntu/ bionic nginx" >> /etc/apt/sources.list.d/nginx.list && \ wget -q http://nginx.org/keys/nginx_signing.key && \ diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 64689904e..dc1b8a27c 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -175,7 +175,7 @@ $utopia->get('/v1/projects/:projectId/usage') ], 'last30' => [ 'start' => DateTime::createFromFormat('U', strtotime('-30 days')), - 'end' => DateTime::createFromFormat('U', strtotime('today')), + 'end' => DateTime::createFromFormat('U', strtotime('tomorrow')), 'group' => '1d', ], 'last90' => [ diff --git a/app/init.php b/app/init.php index 68f45400c..1d8fd2080 100644 --- a/app/init.php +++ b/app/init.php @@ -13,7 +13,6 @@ if (file_exists(__DIR__.'/../vendor/autoload.php')) { use Utopia\App; use Utopia\Request; -use Utopia\Response; use Utopia\Config\Config; use Utopia\Locale\Locale; use Utopia\Registry\Registry; @@ -23,6 +22,7 @@ use Appwrite\Database\Document; use Appwrite\Database\Validator\Authorization; use Appwrite\Database\Adapter\MySQL as MySQLAdapter; use Appwrite\Database\Adapter\Redis as RedisAdapter; +use Appwrite\Response\Response; use PHPMailer\PHPMailer\PHPMailer; const APP_NAME = 'Appwrite'; diff --git a/composer.json b/composer.json index b82772a6e..bed5cc94f 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,7 @@ "ext-imagick": "*", "ext-mbstring": "*", "ext-json": "*", + "ext-yaml": "*", "ext-dom": "*", "ext-redis": "*", "ext-pdo": "*", diff --git a/src/Appwrite/Response/Response.php b/src/Appwrite/Response/Response.php new file mode 100644 index 000000000..06a378ac5 --- /dev/null +++ b/src/Appwrite/Response/Response.php @@ -0,0 +1,42 @@ +setContentType(Response::CONTENT_TYPE_YAML) + ->send(yaml_emit($data, YAML_UTF8_ENCODING)) + ; + } +}