PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / app / SiteSettings.php

SiteSettings.php in Extendify 3.1.5, at app/SiteSettings.php

61 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Controls Draft
5 */
6
7 namespace Extendify;
8
9 defined('ABSPATH') || die('No direct access.');
10
11
12 /**
13 * The controller for interacting with site settings
14 */
15
16 class SiteSettings
17 {
18 /**
19 * Get when the site was created
20 *
21 * @return string|NULL
22 */
23 public static function getSiteCreatedAt()
24 {
25 $cacheKey = 'extendify_site_created_at';
26 $cached = \wp_cache_get($cacheKey);
27 if ($cached) {
28 return $cached;
29 }
30
31 $userOne = \get_userdata(1);
32 if ($userOne) {
33 $createdAt = $userOne->user_registered;
34 \wp_cache_set($cacheKey, $createdAt);
35 return $createdAt;
36 }
37
38 $wpdb = $GLOBALS['wpdb'];
39 // phpcs:ignore WordPress.DB.DirectDatabaseQuery
40 $result = $wpdb->get_row($wpdb->prepare(
41 'SELECT CREATE_TIME
42 FROM INFORMATION_SCHEMA.TABLES
43 WHERE TABLE_SCHEMA = %s
44 AND TABLE_NAME = %s
45 LIMIT 1',
46 $wpdb->dbname,
47 $wpdb->posts
48 ));
49 if (!property_exists($result, 'CREATE_TIME')) {
50 return null;
51 }
52
53 $createdAt = gmdate(
54 'Y-m-d H:i:s',
55 strtotime($result->CREATE_TIME)
56 );
57 \wp_cache_set($cacheKey, $createdAt);
58 return $createdAt;
59 }
60 }
61