Remove automatic software update from the user interface
- This process is not considered safe - This feature might leads to potential security flaws - Miniflux focus on minimalism
This commit is contained in:
parent
82df35a59b
commit
c8234cc3c3
@ -6,6 +6,7 @@ Version 1.2.0 (unreleased)
|
||||
* New config parameter to disable web access for the cronjob
|
||||
* Debug mode parameter is moved to the config file
|
||||
* The console web page have been removed
|
||||
* Remove automatic software update from the user interface
|
||||
* New API methods (not backward compatible)
|
||||
* Fever API tokens are longer than before
|
||||
* Add support for Wallabag service
|
||||
|
@ -28,8 +28,7 @@ Features
|
||||
- Keeps history of read items
|
||||
- Import/Export of OPML feeds
|
||||
- Themes
|
||||
- Auto-update from the user interface
|
||||
- Multiple databases (each user has his own database)
|
||||
- Multiple users
|
||||
- Image proxy to avoid mixed content warnings with HTTPS
|
||||
|
||||
Requirements
|
||||
|
@ -26,11 +26,6 @@ defined('PROXY_PORT') or define('PROXY_PORT', 3128);
|
||||
defined('PROXY_USERNAME') or define('PROXY_USERNAME', '');
|
||||
defined('PROXY_PASSWORD') or define('PROXY_PASSWORD', '');
|
||||
|
||||
defined('ENABLE_AUTO_UPDATE') or define('ENABLE_AUTO_UPDATE', true);
|
||||
defined('AUTO_UPDATE_DOWNLOAD_DIRECTORY') or define('AUTO_UPDATE_DOWNLOAD_DIRECTORY', DATA_DIRECTORY.DIRECTORY_SEPARATOR.'download');
|
||||
defined('AUTO_UPDATE_ARCHIVE_DIRECTORY') or define('AUTO_UPDATE_ARCHIVE_DIRECTORY', DATA_DIRECTORY.DIRECTORY_SEPARATOR.'archive');
|
||||
defined('AUTO_UPDATE_BACKUP_DIRECTORY') or define('AUTO_UPDATE_BACKUP_DIRECTORY', DATA_DIRECTORY.DIRECTORY_SEPARATOR.'backup');
|
||||
|
||||
defined('SUBSCRIPTION_CONCURRENT_REQUESTS') or define('SUBSCRIPTION_CONCURRENT_REQUESTS', 5);
|
||||
|
||||
defined('RULES_DIRECTORY') or define('RULES_DIRECTORY', ROOT_DIRECTORY.DIRECTORY_SEPARATOR.'rules');
|
||||
|
@ -11,27 +11,6 @@ use Miniflux\Template;
|
||||
use Miniflux\Helper;
|
||||
use Miniflux\Model;
|
||||
|
||||
// Confirmation box before auto-update
|
||||
Router\get_action('confirm-auto-update', function () {
|
||||
Response\html(Template\layout('confirm_auto_update', array(
|
||||
'menu' => 'config',
|
||||
'title' => t('Confirmation')
|
||||
)));
|
||||
});
|
||||
|
||||
// Auto-update
|
||||
Router\get_action('auto-update', function () {
|
||||
if (ENABLE_AUTO_UPDATE) {
|
||||
if (Model\AutoUpdate\execute(Helper\config('auto_update_url'))) {
|
||||
SessionStorage::getInstance()->setFlashMessage(t('Miniflux is updated!'));
|
||||
} else {
|
||||
SessionStorage::getInstance()->setFlashErrorMessage(t('Unable to update Miniflux, check the console for errors.'));
|
||||
}
|
||||
}
|
||||
|
||||
Response\redirect('?action=config');
|
||||
});
|
||||
|
||||
// Re-generate tokens
|
||||
Router\get_action('generate-tokens', function () {
|
||||
$user_id = SessionStorage::getInstance()->getUserId();
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => 'قبل %d شهر',
|
||||
'Timezone' => ':المنطقة الزمنية',
|
||||
'Update all subscriptions' => 'تحديث كل الإشتراكات',
|
||||
'Auto-Update URL' => ':تحديث تلقائي للميني فلكس من الرابط',
|
||||
'Update Miniflux' => 'تحديث برنامج Miniflux',
|
||||
'Miniflux is updated!' => 'بنجاح! Miniflux تمت عملية تحديث برنامج',
|
||||
'Don\'t forget to backup your database' => 'لاتنسى إنشاء نسخة إحتياطية من قاعدة البيانات',
|
||||
'The name must have only alpha-numeric characters' => 'يجب إدخال أحرف أو أرقام فقط',
|
||||
'New database' => 'إنشاء قاعدة بيانات جديده',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'مساعدة',
|
||||
'api' => 'api',
|
||||
'about' => 'حول البرنامج',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'سيتم إستبدال هذه النسخة من برنامج ميني فلكس بأحدث نسخه ... هل أنت متأكد من انك تريد ذلك؟ ?',
|
||||
'database' => 'قاعدة البيانات',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'قائمة',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('před měsícem', 'před %d měsíci', 'před %d měsíci'),
|
||||
'Timezone' => 'Časová zóna',
|
||||
'Update all subscriptions' => 'Aktualizovat všechny odběry',
|
||||
'Auto-Update URL' => 'URL automatické aktualizace',
|
||||
'Update Miniflux' => 'Aktualizovat Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux je aktualizovaný!',
|
||||
'Don\'t forget to backup your database' => 'Nezapomeňte zálohovat vaši databázi',
|
||||
'The name must have only alpha-numeric characters' => 'Jméno smí obsahovat pouze písmena a číslice',
|
||||
'New database' => 'Nová databáze',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'nápověda',
|
||||
'api' => 'api',
|
||||
'about' => 'o',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Tato akce aktualizuje Miniflux na poslední vývojovou verzi. Jste si jistí?',
|
||||
'database' => 'databáze',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'nabídka',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('Vor %d Monat', 'Vor %d Monaten'),
|
||||
'Timezone' => 'Zeitzone',
|
||||
'Update all subscriptions' => 'Alle Abonnements aktualisieren',
|
||||
'Auto-Update URL' => 'Auto-Update URL',
|
||||
'Update Miniflux' => 'Miniflux aktualisieren',
|
||||
'Miniflux is updated!' => 'Miniflux wurde erfolgreich aktualisiert!',
|
||||
'Don\'t forget to backup your database' => 'Vergiss nicht, die Datenbank zu sichern',
|
||||
'The name must have only alpha-numeric characters' => 'Der Name darf nur alphanumerische Zeichen enthalten',
|
||||
'New database' => 'Neue Datenbank',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'Hilfe',
|
||||
'api' => 'api',
|
||||
'about' => 'über',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Miniflux wird auf die aktuelle Entwicklungsversion aktualisiert. Bist du sicher?',
|
||||
'database' => 'Datenbank',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'Menü',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('hace %d mes', 'hace %d meses'),
|
||||
'Timezone' => 'Zona horaria',
|
||||
'Update all subscriptions' => 'Actualizar todas las subscripciones',
|
||||
'Auto-Update URL' => 'Actualizar automáticamente la URL',
|
||||
'Update Miniflux' => 'Actualizar Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux esta actualizado',
|
||||
'Don\'t forget to backup your database' => 'No olvides de hacer una copia de seguridad de la base de datos',
|
||||
'The name must have only alpha-numeric characters' => 'El nombre sólo puede contener caractéres alfanuméricos',
|
||||
'New database' => 'Nueva base de datos',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'ayuda',
|
||||
'api' => 'api',
|
||||
'about' => 'acerca de',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Esta acción actualizará Miniflux a la última versión de desarrollo, ¿está seguro?',
|
||||
'database' => 'base de datos',
|
||||
'Miniflux API' => 'API Miniflux',
|
||||
'menu' => 'menú',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => 'Il y a %d mois',
|
||||
'Timezone' => 'Fuseau horaire',
|
||||
'Update all subscriptions' => 'Mettre à jour tous les abonnements',
|
||||
'Auto-Update URL' => 'URL de mise à jour automatique',
|
||||
'Update Miniflux' => 'Mettre à jour Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux a été mis à jour avec succès !',
|
||||
'Don\'t forget to backup your database' => 'N\'oubliez pas de sauvegarder votre base de données',
|
||||
'The name must have only alpha-numeric characters' => 'Le nom doit avoir seulement des caractères alphanumériques',
|
||||
'New database' => 'Nouvelle base de données',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'aide',
|
||||
'api' => 'api',
|
||||
'about' => 'a propos',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Cette action va mettre à jour Miniflux avec la dernière version en cours de développement, êtes-vous certain ?',
|
||||
'database' => 'base de données',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'menu',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
// '%d month ago' => '',
|
||||
// 'Timezone' => '',
|
||||
// 'Update all subscriptions' => '',
|
||||
// 'Auto-Update URL' => '',
|
||||
// 'Update Miniflux' => '',
|
||||
// 'Miniflux is updated!' => '',
|
||||
// 'Don\'t forget to backup your database' => '',
|
||||
// 'The name must have only alpha-numeric characters' => '',
|
||||
// 'New database' => '',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
// 'help' => '',
|
||||
// 'api' => '',
|
||||
// 'about' => '',
|
||||
// 'This action will update Miniflux with the last development version, are you sure?' => '',
|
||||
// 'database' => '',
|
||||
// 'Miniflux API' => '',
|
||||
// 'menu' => '',
|
||||
|
@ -156,9 +156,6 @@ return array(
|
||||
'%d month ago' => '%dヶ月前',
|
||||
'Timezone' => 'タイムゾーン',
|
||||
'Update all subscriptions' => 'すべての購読を更新',
|
||||
'Auto-Update URL' => '自動更新のURL',
|
||||
'Update Miniflux' => 'Minifluxを更新',
|
||||
'Miniflux is updated!' => 'Minifluxは更新されました!',
|
||||
'Don\'t forget to backup your database' => 'データベースのバックアップを忘れないで下さい',
|
||||
'The name must have only alpha-numeric characters' => '名前には英数字のみを使用することが出来ます',
|
||||
'New database' => '新しいデータベース',
|
||||
@ -199,7 +196,6 @@ return array(
|
||||
'help' => 'ヘルプ',
|
||||
'api' => 'API',
|
||||
'about' => 'Minifluxについて',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => '最新の開発バージョンでMinifluxを更新します。よろしいですか?',
|
||||
'database' => 'データベース',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'メニュー',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('%d mês atrás', '%d meses atrás'),
|
||||
'Timezone' => 'Fuso horário',
|
||||
'Update all subscriptions' => 'Atualizar todas as assinaturas',
|
||||
'Auto-Update URL' => 'URL de atualização automática',
|
||||
'Update Miniflux' => 'Atualizar Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux foi atualizado!',
|
||||
'Don\'t forget to backup your database' => 'Não esqueça de fazer backup de seu banco de dados',
|
||||
'The name must have only alpha-numeric characters' => 'O nome deve conter apenas caracteres alfa-numéricos',
|
||||
'New database' => 'Novo banco de dados',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'ajuda',
|
||||
'api' => 'api',
|
||||
'about' => 'sobre',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Esta ação irá atualizar o Miniflux com a última versão de desenvolvimento, você tem certeza?',
|
||||
'database' => 'banco de dados',
|
||||
'Miniflux API' => 'API do Miniflux',
|
||||
'menu' => 'menu',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('%d месяц назад', '%d месяца назад', '%d месяцев назад'),
|
||||
'Timezone' => 'Временная зона',
|
||||
'Update all subscriptions' => 'Обновить все подписки',
|
||||
'Auto-Update URL' => 'URL автоматического обновления',
|
||||
'Update Miniflux' => 'Обновить Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux обновлен!',
|
||||
'Don\'t forget to backup your database' => 'Не забудьте предварительно сделать резервную копию базы данных',
|
||||
'The name must have only alpha-numeric characters' => 'Название должно состоять только из алфавитно-цифровых символов',
|
||||
'New database' => 'Новая база данных',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'помощь',
|
||||
'api' => 'api',
|
||||
'about' => 'о программе',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Это действие обновит Miniflux до последней разрабатываемой версии, вы уверены?',
|
||||
'database' => 'база данных',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'меню',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('Пре %d месец', 'Пре %d месеца', 'Пре %d месеци'),
|
||||
'Timezone' => 'Временска зона',
|
||||
'Update all subscriptions' => 'Ажурирај све претплате',
|
||||
'Auto-Update URL' => 'УРЛ за аутоматско ажурирање',
|
||||
'Update Miniflux' => 'Ажурирај Минифлукс',
|
||||
'Miniflux is updated!' => 'Минифлукс је успешно ажуриран !',
|
||||
'Don\'t forget to backup your database' => 'Не заборавите да бекапујете базу података',
|
||||
'The name must have only alpha-numeric characters' => 'Име може садржати само бројеве или слова',
|
||||
'New database' => 'Нова база података',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'помоћ',
|
||||
'api' => 'апи',
|
||||
'about' => 'о програму',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Ова акција ће ажурирати Минифлукс на најновију развојну верију, да ли сте сигурни?',
|
||||
'database' => 'база података',
|
||||
'Miniflux API' => 'АПИ Минифлукса',
|
||||
'menu' => 'мени',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => array('Pre %d mesec', 'Pre %d meseca', 'Pre %d meseci'),
|
||||
'Timezone' => 'Vremenska zona',
|
||||
'Update all subscriptions' => 'Ažuriraj sve pretplate',
|
||||
'Auto-Update URL' => 'URL za automatsko ažuriranje',
|
||||
'Update Miniflux' => 'Ažuriraj Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux je uspešno ažuriran !',
|
||||
'Don\'t forget to backup your database' => 'Ne zaboravite da bekapujete bazu podataka',
|
||||
'The name must have only alpha-numeric characters' => 'Ime može sadržati samo brojeve ili slova',
|
||||
'New database' => 'Nova baza podataka',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'pomoć',
|
||||
'api' => 'api',
|
||||
'about' => 'o programu',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Ova akcija će ažurirati Miniflux na najnoviju razvojnu veriju, da li ste sigurni?',
|
||||
'database' => 'baza podataka',
|
||||
'Miniflux API' => 'API Minifluxa',
|
||||
'menu' => 'meni',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => '%d ay önce',
|
||||
'Timezone' => 'Zaman dilimi',
|
||||
'Update all subscriptions' => 'Tüm abonelikleri güncelle',
|
||||
'Auto-Update URL' => 'Otomatik güncelleme bağlantısı',
|
||||
'Update Miniflux' => 'Miniflux\'ı Güncelle',
|
||||
'Miniflux is updated!' => 'Miniflux güncellendi!',
|
||||
'Don\'t forget to backup your database' => 'Veritabanınızı yedeklemeyi unutmayın',
|
||||
'The name must have only alpha-numeric characters' => 'İsim yalnızca alfanümerik karakterler içermeli',
|
||||
'New database' => 'Yeni veritabanı',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => 'yardım',
|
||||
'api' => 'api',
|
||||
'about' => 'hakkında',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => 'Bu işlem Miniflux\'u en son yayınlanan geliştirme sürümüne güncelleyecektir, emin misiniz?',
|
||||
'database' => 'veritabanı',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => 'menü',
|
||||
|
@ -154,9 +154,6 @@ return array(
|
||||
'%d month ago' => '%d月前',
|
||||
'Timezone' => '时区',
|
||||
'Update all subscriptions' => '更新所有的订阅',
|
||||
'Auto-Update URL' => '自动更新URL',
|
||||
'Update Miniflux' => '更新Miniflux',
|
||||
'Miniflux is updated!' => 'Miniflux已被更新!',
|
||||
'Don\'t forget to backup your database' => '不要忘记备份你的数据库',
|
||||
'The name must have only alpha-numeric characters' => '名字只能包含字母和数字',
|
||||
'New database' => '新数据库',
|
||||
@ -197,7 +194,6 @@ return array(
|
||||
'help' => '帮助',
|
||||
'api' => '接口',
|
||||
'about' => '关于',
|
||||
'This action will update Miniflux with the last development version, are you sure?' => '这个操作将更新Miniflux到最新的开发版,你确认吗?',
|
||||
'database' => '数据库',
|
||||
'Miniflux API' => 'Miniflux API',
|
||||
'menu' => '菜单',
|
||||
|
@ -1,221 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Miniflux\Model\AutoUpdate;
|
||||
|
||||
use ZipArchive;
|
||||
use DirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use RecursiveDirectoryIterator;
|
||||
use Miniflux\Model\Config;
|
||||
|
||||
// Get all files of a given directory
|
||||
function get_files_list($directory)
|
||||
{
|
||||
$exclude_list = array(
|
||||
'.git',
|
||||
'data',
|
||||
'scripts',
|
||||
'config.php',
|
||||
'rules',
|
||||
);
|
||||
|
||||
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory), RecursiveIteratorIterator::SELF_FIRST);
|
||||
$files = array();
|
||||
|
||||
while ($it->valid()) {
|
||||
if ($it->isFile() && ! is_excluded_path($it->getSubPathname(), $exclude_list)) {
|
||||
$files[] = $it->getSubPathname();
|
||||
}
|
||||
|
||||
$it->next();
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
// Check if the given path is excluded
|
||||
function is_excluded_path($path, array $exclude_list)
|
||||
{
|
||||
foreach ($exclude_list as $excluded_path) {
|
||||
if (strpos($path, $excluded_path) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Synchronize 2 directories (copy/remove files)
|
||||
function synchronize($source_directory, $destination_directory)
|
||||
{
|
||||
$src_files = get_files_list($source_directory);
|
||||
$dst_files = get_files_list($destination_directory);
|
||||
|
||||
// Remove files
|
||||
$remove_files = array_diff($dst_files, $src_files);
|
||||
|
||||
foreach ($remove_files as $file) {
|
||||
if ($file !== '.htaccess') {
|
||||
$destination_file = $destination_directory.DIRECTORY_SEPARATOR.$file;
|
||||
|
||||
if (! @unlink($destination_file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Overwrite all files
|
||||
foreach ($src_files as $file) {
|
||||
$directory = $destination_directory.DIRECTORY_SEPARATOR.dirname($file);
|
||||
|
||||
if (! is_dir($directory)) {
|
||||
if (! @mkdir($directory, 0755, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$source_file = $source_directory.DIRECTORY_SEPARATOR.$file;
|
||||
$destination_file = $destination_directory.DIRECTORY_SEPARATOR.$file;
|
||||
|
||||
if (! @copy($source_file, $destination_file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Download and unzip the archive
|
||||
function uncompress_archive($url, $download_directory = AUTO_UPDATE_DOWNLOAD_DIRECTORY, $archive_directory = AUTO_UPDATE_ARCHIVE_DIRECTORY)
|
||||
{
|
||||
$archive_file = $download_directory.DIRECTORY_SEPARATOR.'update.zip';
|
||||
if (($data = @file_get_contents($url)) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (@file_put_contents($archive_file, $data) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$zip = new ZipArchive;
|
||||
|
||||
if (! $zip->open($archive_file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$zip->extractTo($archive_directory);
|
||||
$zip->close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Remove all files for a given directory
|
||||
function cleanup_directory($directory)
|
||||
{
|
||||
$dir = new DirectoryIterator($directory);
|
||||
|
||||
foreach ($dir as $fileinfo) {
|
||||
if (! $fileinfo->isDot()) {
|
||||
$filename = $fileinfo->getRealPath();
|
||||
|
||||
if ($fileinfo->isFile()) {
|
||||
@unlink($filename);
|
||||
} else {
|
||||
cleanup_directory($filename);
|
||||
@rmdir($filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup all temporary directories
|
||||
function cleanup_directories()
|
||||
{
|
||||
cleanup_directory(AUTO_UPDATE_DOWNLOAD_DIRECTORY);
|
||||
cleanup_directory(AUTO_UPDATE_ARCHIVE_DIRECTORY);
|
||||
cleanup_directory(AUTO_UPDATE_BACKUP_DIRECTORY);
|
||||
}
|
||||
|
||||
// Find the archive directory name
|
||||
function find_archive_root($base_directory = AUTO_UPDATE_ARCHIVE_DIRECTORY)
|
||||
{
|
||||
$directory = '';
|
||||
$dir = new DirectoryIterator($base_directory);
|
||||
|
||||
foreach ($dir as $fileinfo) {
|
||||
if (! $fileinfo->isDot() && $fileinfo->isDir()) {
|
||||
$directory = $fileinfo->getFilename();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($directory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $base_directory.DIRECTORY_SEPARATOR.$directory;
|
||||
}
|
||||
|
||||
// Check if everything is setup correctly
|
||||
function check_setup()
|
||||
{
|
||||
if (! class_exists('ZipArchive')) {
|
||||
die('To use this feature, your PHP installation must be able to uncompress zip files!');
|
||||
}
|
||||
|
||||
if (AUTO_UPDATE_DOWNLOAD_DIRECTORY === '') {
|
||||
die('The constant AUTO_UPDATE_DOWNLOAD_DIRECTORY is not set!');
|
||||
}
|
||||
if (AUTO_UPDATE_ARCHIVE_DIRECTORY === '') {
|
||||
die('The constant AUTO_UPDATE_ARCHIVE_DIRECTORY is not set!');
|
||||
}
|
||||
if (AUTO_UPDATE_DOWNLOAD_DIRECTORY === '') {
|
||||
die('The constant AUTO_UPDATE_DOWNLOAD_DIRECTORY is not set!');
|
||||
}
|
||||
|
||||
if (! is_dir(AUTO_UPDATE_DOWNLOAD_DIRECTORY)) {
|
||||
@mkdir(AUTO_UPDATE_DOWNLOAD_DIRECTORY, 0755);
|
||||
}
|
||||
if (! is_dir(AUTO_UPDATE_ARCHIVE_DIRECTORY)) {
|
||||
@mkdir(AUTO_UPDATE_ARCHIVE_DIRECTORY, 0755);
|
||||
}
|
||||
if (! is_dir(AUTO_UPDATE_BACKUP_DIRECTORY)) {
|
||||
@mkdir(AUTO_UPDATE_BACKUP_DIRECTORY, 0755);
|
||||
}
|
||||
|
||||
if (! is_writable(AUTO_UPDATE_DOWNLOAD_DIRECTORY)) {
|
||||
die('Update directories must be writable by your web server user!');
|
||||
}
|
||||
if (! is_writable(__DIR__)) {
|
||||
die('Source files must be writable by your web server user!');
|
||||
}
|
||||
}
|
||||
|
||||
// Update the source code
|
||||
function execute($url)
|
||||
{
|
||||
check_setup();
|
||||
cleanup_directories();
|
||||
|
||||
if (uncompress_archive($url)) {
|
||||
$update_directory = find_archive_root();
|
||||
|
||||
if ($update_directory) {
|
||||
|
||||
// Backup first
|
||||
if (synchronize(ROOT_DIRECTORY, AUTO_UPDATE_BACKUP_DIRECTORY)) {
|
||||
|
||||
// Update
|
||||
if (synchronize($update_directory, ROOT_DIRECTORY)) {
|
||||
cleanup_directories();
|
||||
return true;
|
||||
} else {
|
||||
// If update failed, rollback
|
||||
synchronize(AUTO_UPDATE_BACKUP_DIRECTORY, ROOT_DIRECTORY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
@ -29,11 +29,6 @@
|
||||
<?php echo Miniflux\Helper\form_label(t('Theme'), 'theme') ?>
|
||||
<?php echo Miniflux\Helper\form_select('theme', $theme_options, $values, $errors) ?><br/>
|
||||
|
||||
<?php if (ENABLE_AUTO_UPDATE): ?>
|
||||
<?php echo Miniflux\Helper\form_label(t('Auto-Update URL'), 'auto_update_url') ?>
|
||||
<?php echo Miniflux\Helper\form_text('auto_update_url', $values, $errors) ?><br/>
|
||||
<?php endif ?>
|
||||
|
||||
<?php echo Miniflux\Helper\form_checkbox('image_proxy', t('Enable image proxy'), 1, isset($values['image_proxy']) && $values['image_proxy'] == 1) ?>
|
||||
<div class="form-help"><?php echo t('Avoid mixed content warnings with HTTPS') ?></div>
|
||||
</div>
|
||||
@ -81,8 +76,5 @@
|
||||
<section class="panel panel-danger">
|
||||
<ul>
|
||||
<li><a href="?action=generate-tokens&csrf=<?php echo $values['csrf'] ?>"><?php echo t('Generate new tokens') ?></a> (<?php echo t('Miniflux API') ?>, <?php echo t('Fever API') ?>, <?php echo t('Bookmarklet') ?>, <?php echo t('Bookmark RSS Feed') ?>)</li>
|
||||
<?php if (ENABLE_AUTO_UPDATE): ?>
|
||||
<li><a href="?action=confirm-auto-update"><?php echo t('Update Miniflux') ?></a> (<?php echo t('Don\'t forget to backup your database') ?>)</li>
|
||||
<?php endif ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
@ -1,10 +0,0 @@
|
||||
<div class="page-header">
|
||||
<h2><?php echo t('Confirmation') ?></h2>
|
||||
</div>
|
||||
|
||||
<p class="alert alert-info"><?php echo t('This action will update Miniflux with the last development version, are you sure?') ?></p>
|
||||
|
||||
<div class="form-actions">
|
||||
<a href="?action=auto-update" class="btn btn-red"><?php echo t('Update Miniflux') ?></a>
|
||||
<?php echo t('or') ?> <a href="?action=config"><?php echo t('cancel') ?></a>
|
||||
</div>
|
@ -53,7 +53,6 @@
|
||||
"app/models/item_feed.php",
|
||||
"app/models/item_group.php",
|
||||
"app/models/bookmark.php",
|
||||
"app/models/auto_update.php",
|
||||
"app/models/remember_me.php",
|
||||
"app/models/group.php",
|
||||
"app/models/favicon.php",
|
||||
|
@ -42,9 +42,6 @@ define('PROXY_USERNAME', '');
|
||||
// PROXY_PASSWORD => default is empty
|
||||
define('PROXY_PASSWORD', '');
|
||||
|
||||
// ENABLE_AUTO_UPDATE => default is true (enable Miniflux update from the user interface)
|
||||
define('ENABLE_AUTO_UPDATE', true);
|
||||
|
||||
// SUBSCRIPTION_CONCURRENT_REQUESTS => number of concurrent feeds to refresh at once
|
||||
// Reduce this number on systems with limited processing power
|
||||
define('SUBSCRIPTION_CONCURRENT_REQUESTS', 5);
|
||||
|
4
data/archive/.gitignore
vendored
4
data/archive/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
data/backup/.gitignore
vendored
4
data/backup/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
4
data/download/.gitignore
vendored
4
data/download/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
@ -56,9 +56,6 @@ define('PROXY_USERNAME', '');
|
||||
// PROXY_PASSWORD => default is empty
|
||||
define('PROXY_PASSWORD', '');
|
||||
|
||||
// ENABLE_AUTO_UPDATE => default is true (enable Miniflux update from the user interface)
|
||||
define('ENABLE_AUTO_UPDATE', true);
|
||||
|
||||
// SUBSCRIPTION_CONCURRENT_REQUESTS => number of concurrent feeds to refresh at once
|
||||
// Reduce this number on systems with limited processing power
|
||||
define('SUBSCRIPTION_CONCURRENT_REQUESTS', 5);
|
||||
|
@ -81,6 +81,7 @@ function copy_settings(PDO $db, $user_id, array $settings)
|
||||
'feed_token',
|
||||
'fever_token',
|
||||
'debug_mode',
|
||||
'auto_update_url',
|
||||
);
|
||||
|
||||
$rq = $db->prepare('INSERT INTO user_settings ("user_id", "key", "value") VALUES (?, ?, ?)');
|
||||
|
1
vendor/composer/autoload_files.php
vendored
1
vendor/composer/autoload_files.php
vendored
@ -34,7 +34,6 @@ return array(
|
||||
'c0f7d31e45ab3b885f3f3567be6b8cda' => $baseDir . '/app/models/item_feed.php',
|
||||
'c9e2906d32a129f63c98d210037c227b' => $baseDir . '/app/models/item_group.php',
|
||||
'546998ee103e300ad614144f30a1de8e' => $baseDir . '/app/models/bookmark.php',
|
||||
'd06207bd4580f7e9250cf39d0d648fc5' => $baseDir . '/app/models/auto_update.php',
|
||||
'ee585b658e324609d721bc6f959e85c8' => $baseDir . '/app/models/remember_me.php',
|
||||
'fc49fda782025f9f73852265b1fa7760' => $baseDir . '/app/models/group.php',
|
||||
'785cebb801997d40232b8337459f1606' => $baseDir . '/app/models/favicon.php',
|
||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -35,7 +35,6 @@ class ComposerStaticInitfd7e8d436e1dc450edc3153ac8bc31b4
|
||||
'c0f7d31e45ab3b885f3f3567be6b8cda' => __DIR__ . '/../..' . '/app/models/item_feed.php',
|
||||
'c9e2906d32a129f63c98d210037c227b' => __DIR__ . '/../..' . '/app/models/item_group.php',
|
||||
'546998ee103e300ad614144f30a1de8e' => __DIR__ . '/../..' . '/app/models/bookmark.php',
|
||||
'd06207bd4580f7e9250cf39d0d648fc5' => __DIR__ . '/../..' . '/app/models/auto_update.php',
|
||||
'ee585b658e324609d721bc6f959e85c8' => __DIR__ . '/../..' . '/app/models/remember_me.php',
|
||||
'fc49fda782025f9f73852265b1fa7760' => __DIR__ . '/../..' . '/app/models/group.php',
|
||||
'785cebb801997d40232b8337459f1606' => __DIR__ . '/../..' . '/app/models/favicon.php',
|
||||
|
Loading…
Reference in New Issue
Block a user