Subversion Repositories oidplus

Rev

Rev 698 | Rev 702 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 698 Rev 699
Line 1302... Line 1302...
1302
                        }
1302
                        }
1303
                }
1303
                }
1304
                return self::$translationArray;
1304
                return self::$translationArray;
1305
        }
1305
        }
1306
 
1306
 
-
 
1307
        public static function getEditionInfo() {
-
 
1308
                return @parse_ini_file(__DIR__.'/../edition.ini', true)['Edition'];
-
 
1309
        }
-
 
1310
 
1307
        public static function findGitFolder() {
1311
        public static function findGitFolder() {
1308
                // Git command line saves git information in folder ".git"
1312
                // Git command line saves git information in folder ".git"
1309
                // Plesk git saves git information in folder "../../../git/oidplus/" (or similar)
1313
                // Plesk git saves git information in folder "../../../git/oidplus/" (or similar)
1310
                $dir = realpath(__DIR__);
1314
                $dir = realpath(__DIR__);
1311
                if (is_dir($dir.'/.git')) return $dir.'/.git';
1315
                if (is_dir($dir.'/.git')) return $dir.'/.git';
Line 1313... Line 1317...
1313
                do {
1317
                do {
1314
                        if (is_dir($dir.'/git')) {
1318
                        if (is_dir($dir.'/git')) {
1315
                                $confs = glob($dir.'/git/'.'*'.'/config');
1319
                                $confs = glob($dir.'/git/'.'*'.'/config');
1316
                                foreach ($confs as $conf) {
1320
                                foreach ($confs as $conf) {
1317
                                        $cont = file_get_contents($conf);
1321
                                        $cont = file_get_contents($conf);
1318
                                        if (strpos($cont, '://github.com/danielmarschall/oidplus') !== false) {
1322
                                        if (isset(OIDplus::getEditionInfo()['gitrepo']) && (OIDplus::getEditionInfo()['gitrepo'] != '') && (strpos($cont, OIDplus::getEditionInfo()['gitrepo']) !== false)) {
1319
                                                return dirname($conf);
1323
                                                return dirname($conf);
1320
                                        }
1324
                                        }
1321
                                }
1325
                                }
1322
                        }
1326
                        }
1323
                        $i++;
1327
                        $i++;
Line 1326... Line 1330...
1326
        }
1330
        }
1327
 
1331
 
1328
        public static function getGitsvnRevision($dir='') {
1332
        public static function getGitsvnRevision($dir='') {
1329
                try {
1333
                try {
1330
                        // tries command line and binary parsing
1334
                        // tries command line and binary parsing
1331
                        // requires danielmarschall/git_utils.inc.php
1335
                        // requires vendor/danielmarschall/git_utils.inc.php
1332
                        $git_dir = OIDplus::findGitFolder();
1336
                        $git_dir = OIDplus::findGitFolder();
1333
                        if ($git_dir === false) return false;
1337
                        if ($git_dir === false) return false;
1334
                        $commit_msg = git_get_latest_commit_message($git_dir);
1338
                        $commit_msg = git_get_latest_commit_message($git_dir);
1335
                } catch (Exception $e) {
1339
                } catch (Exception $e) {
1336
                        return false;
1340
                        return false;