mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-16 03:03:42 -04:00
Housekeeping lib_rss.php (#8193)
* Housekeeping lib_rss.php `lib_rss.php` had become much too large, especially after https://github.com/FreshRSS/FreshRSS/pull/7924 Moved most functions to other places. Mostly no change of code otherwise (see comments). * Extension: composer run-script phpstan-third-party
This commit is contained in:
committed by
GitHub
parent
5e622c60fa
commit
a18c35046d
@@ -334,14 +334,85 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check PHP and its extensions are well-installed.
|
||||
*
|
||||
* @return array<string,bool> of tested values.
|
||||
*/
|
||||
private static function check_install_php(): array {
|
||||
$pdo_mysql = extension_loaded('pdo_mysql');
|
||||
$pdo_pgsql = extension_loaded('pdo_pgsql');
|
||||
$pdo_sqlite = extension_loaded('pdo_sqlite');
|
||||
return [
|
||||
'php' => version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION) >= 0,
|
||||
'curl' => extension_loaded('curl'),
|
||||
'pdo' => $pdo_mysql || $pdo_sqlite || $pdo_pgsql,
|
||||
'pcre' => extension_loaded('pcre'),
|
||||
'ctype' => extension_loaded('ctype'),
|
||||
'fileinfo' => extension_loaded('fileinfo'),
|
||||
'dom' => class_exists('DOMDocument'),
|
||||
'json' => extension_loaded('json'),
|
||||
'mbstring' => extension_loaded('mbstring'),
|
||||
'zip' => extension_loaded('zip'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check different data files and directories exist.
|
||||
* @return array<string,bool> of tested values.
|
||||
*/
|
||||
private static function check_install_files(): array {
|
||||
return [
|
||||
'data' => is_dir(DATA_PATH) && touch(DATA_PATH . '/index.html'), // is_writable() is not reliable for a folder on NFS
|
||||
'cache' => is_dir(CACHE_PATH) && touch(CACHE_PATH . '/index.html'),
|
||||
'users' => is_dir(USERS_PATH) && touch(USERS_PATH . '/index.html'),
|
||||
'favicons' => is_dir(DATA_PATH) && touch(DATA_PATH . '/favicons/index.html'),
|
||||
'tokens' => is_dir(DATA_PATH) && touch(DATA_PATH . '/tokens/index.html'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check database is well-installed.
|
||||
*
|
||||
* @return array<string,bool> of tested values.
|
||||
*/
|
||||
private static function check_install_database(): array {
|
||||
$status = [
|
||||
'connection' => true,
|
||||
'tables' => false,
|
||||
'categories' => false,
|
||||
'feeds' => false,
|
||||
'entries' => false,
|
||||
'entrytmp' => false,
|
||||
'tag' => false,
|
||||
'entrytag' => false,
|
||||
];
|
||||
|
||||
try {
|
||||
$dbDAO = FreshRSS_Factory::createDatabaseDAO();
|
||||
|
||||
$status['tables'] = $dbDAO->tablesAreCorrect();
|
||||
$status['categories'] = $dbDAO->categoryIsCorrect();
|
||||
$status['feeds'] = $dbDAO->feedIsCorrect();
|
||||
$status['entries'] = $dbDAO->entryIsCorrect();
|
||||
$status['entrytmp'] = $dbDAO->entrytmpIsCorrect();
|
||||
$status['tag'] = $dbDAO->tagIsCorrect();
|
||||
$status['entrytag'] = $dbDAO->entrytagIsCorrect();
|
||||
} catch (Minz_PDOConnectionException $e) {
|
||||
$status['connection'] = false;
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* This action displays information about installation.
|
||||
*/
|
||||
public function checkInstallAction(): void {
|
||||
FreshRSS_View::prependTitle(_t('admin.check_install.title') . ' · ');
|
||||
|
||||
$this->view->status_php = check_install_php();
|
||||
$this->view->status_files = check_install_files();
|
||||
$this->view->status_database = check_install_database();
|
||||
$this->view->status_php = self::check_install_php();
|
||||
$this->view->status_files = self::check_install_files();
|
||||
$this->view->status_database = self::check_install_database();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user