]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Photo.php
Merge pull request #8230 from AlfredSK/AlfredSK-statistics-query
[friendica.git] / src / Model / Photo.php
index b29ac65645739aa54e4c87be2c2460629fe0c8d0..ccb0f2add4e972ecee1a89c1df2ae71b43c99c8d 100644 (file)
@@ -1,14 +1,27 @@
 <?php
-
 /**
- * @file src/Model/Photo.php
- * This file contains the Photo class for database interface
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 namespace Friendica\Model;
 
 use Friendica\Core\Cache\Duration;
-use Friendica\Core\Config;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -542,7 +555,7 @@ class Photo
                $key = "photo_albums:".$uid.":".local_user().":".remote_user();
                $albums = DI::cache()->get($key);
                if (is_null($albums) || $update) {
-                       if (!Config::get("system", "no_count", false)) {
+                       if (!DI::config()->get("system", "no_count", false)) {
                                /// @todo This query needs to be renewed. It is really slow
                                // At this time we just store the data in the cache
                                $albums = q("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`, ANY_VALUE(`created`) AS `created`
@@ -551,7 +564,7 @@ class Photo
                                        GROUP BY `album` ORDER BY `created` DESC",
                                        intval($uid),
                                        DBA::escape("Contact Photos"),
-                                       DBA::escape(L10n::t("Contact Photos"))
+                                       DBA::escape(DI::l10n()->t("Contact Photos"))
                                );
                        } else {
                                // This query doesn't do the count and is much faster
@@ -560,7 +573,7 @@ class Photo
                                        WHERE `uid` = %d  AND `album` != '%s' AND `album` != '%s' $sql_extra",
                                        intval($uid),
                                        DBA::escape("Contact Photos"),
-                                       DBA::escape(L10n::t("Contact Photos"))
+                                       DBA::escape(DI::l10n()->t("Contact Photos"))
                                );
                        }
                        DI::cache()->set($key, $albums, Duration::DAY);