Changeset 9729 for extensions/autoupdate/trunk/update_ext.inc.php
- Timestamp:
- Mar 16, 2011, 7:27:11 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/autoupdate/trunk/update_ext.inc.php
r9723 r9729 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 // Plugins 6 include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php'); 7 $plugins = new plugins(); 8 $update_plugins = array(); 9 if ($plugins->get_server_plugins()) 5 include_once(AUTOUPDATE_PATH.'include/autoupdate.class.php'); 6 $autoupdate = new autoupdate(); 7 8 if (!$autoupdate->get_server_extensions()) 10 9 { 11 foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) 10 array_push($page['errors'], l10n('Can\'t connect to server.')); 11 return; 12 } 13 14 foreach ($autoupdate->types as $type) 15 { 16 $fs = 'fs_'.$type; 17 $server = 'server_'.$type; 18 $server_ext = $autoupdate->$type->$server; 19 $fs_ext = $autoupdate->$type->$fs; 20 21 if (!empty($server_ext)) 12 22 { 13 if (isset($fs_plugin['extension']) 14 and isset($plugins->server_plugins[$fs_plugin['extension']])) 23 foreach($fs_ext as $ext_id => $fs_ext) 15 24 { 16 $plugin_info = $plugins->server_plugins[$fs_plugin['extension']]; 25 if (isset($fs_ext['extension']) and isset($server_ext[$fs_ext['extension']])) 26 { 27 $ext_info = $server_ext[$fs_ext['extension']]; 17 28 18 if (!$plugins->plugin_version_compare($fs_plugin['version'], $plugin_info['revision_name'])) 19 { 20 $update_plugins[] = array( 21 'ID' => $plugin_info['extension_id'], 22 'PLUGIN_ID' => $plugin_id, 23 'REVISION_ID' => $plugin_info['revision_id'], 24 'EXT_NAME' => $fs_plugin['name'], 25 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'], 26 'EXT_DESC' => trim($plugin_info['extension_description'], " \n\r"), 27 'REV_DESC' => trim($plugin_info['revision_description'], " \n\r"), 28 'CURRENT_VERSION' => $fs_plugin['version'], 29 'NEW_VERSION' => $plugin_info['revision_name'], 30 'AUTHOR' => $plugin_info['author_name'], 31 'DOWNLOADS' => $plugin_info['extension_nb_downloads'], 32 'URL_DOWNLOAD' => $plugin_info['download_url'] . '&origin=piwigo_download', 33 'IGNORED' => in_array($plugin_id, $conf['AU_ignore']['plugins']), 34 ); 29 if (!$autoupdate->version_compare($fs_ext['version'], $ext_info['revision_name'], $type)) 30 { 31 $template->append('update_'.$type, array( 32 'ID' => $ext_info['extension_id'], 33 'REVISION_ID' => $ext_info['revision_id'], 34 'EXT_ID' => $ext_id, 35 'EXT_NAME' => $fs_ext['name'], 36 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$ext_info['extension_id'], 37 'EXT_DESC' => trim($ext_info['extension_description'], " \n\r"), 38 'REV_DESC' => trim($ext_info['revision_description'], " \n\r"), 39 'CURRENT_VERSION' => $fs_ext['version'], 40 'NEW_VERSION' => $ext_info['revision_name'], 41 'AUTHOR' => $ext_info['author_name'], 42 'DOWNLOADS' => $ext_info['extension_nb_downloads'], 43 'URL_DOWNLOAD' => $ext_info['download_url'] . '&origin=piwigo_download', 44 'IGNORED' => in_array($ext_id, $conf['AU_ignore']['plugins']), 45 ) 46 ); 47 } 35 48 } 36 49 } … … 38 51 } 39 52 40 // Themes41 include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');42 $themes = new themes();43 $update_themes = array();44 if ($themes->get_server_themes())45 {46 foreach($themes->fs_themes as $theme_id => $fs_theme)47 {48 if (isset($fs_theme['extension'])49 and isset($themes->server_themes[$fs_theme['extension']]))50 {51 $theme_info = $themes->server_themes[$fs_theme['extension']];52 53 if (!$themes->theme_version_compare($fs_theme['version'], $theme_info['revision_name']))54 {55 $update_themes[] = array(56 'ID' => $theme_info['extension_id'],57 'THEME_ID' => $theme_id,58 'REVISION_ID' => $theme_info['revision_id'],59 'EXT_NAME' => $fs_theme['name'],60 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$theme_info['extension_id'],61 'EXT_DESC' => trim($theme_info['extension_description'], " \n\r"),62 'REV_DESC' => trim($theme_info['revision_description'], " \n\r"),63 'CURRENT_VERSION' => $fs_theme['version'],64 'NEW_VERSION' => $theme_info['revision_name'],65 'AUTHOR' => $theme_info['author_name'],66 'DOWNLOADS' => $theme_info['extension_nb_downloads'],67 'URL_DOWNLOAD' => $theme_info['download_url'] . '&origin=piwigo_download',68 'IGNORED' => in_array($theme_id, $conf['AU_ignore']['themes']),69 );70 }71 }72 }73 }74 75 // Languages76 include_once(PHPWG_ROOT_PATH.'admin/include/languages.class.php');77 $languages = new languages();78 $update_languages = array();79 if ($languages->get_server_languages())80 {81 foreach($languages->fs_languages as $language_id => $fs_language)82 {83 if (isset($fs_language['extension'])84 and isset($languages->server_languages[$fs_language['extension']]))85 {86 $language_info = $languages->server_languages[$fs_language['extension']];87 88 if (!$languages->language_version_compare($fs_language['version'], $language_info['revision_name']))89 {90 $update_languages[] = array(91 'ID' => $language_info['extension_id'],92 'LANGUAGE_ID' => $language_id,93 'REVISION_ID' => $language_info['revision_id'],94 'EXT_NAME' => $fs_language['name'],95 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$language_info['extension_id'],96 'EXT_DESC' => trim($language_info['extension_description'], " \n\r"),97 'REV_DESC' => trim($language_info['revision_description'], " \n\r"),98 'CURRENT_VERSION' => $fs_language['version'],99 'NEW_VERSION' => $language_info['revision_name'],100 'AUTHOR' => $language_info['author_name'],101 'DOWNLOADS' => $language_info['extension_nb_downloads'],102 'URL_DOWNLOAD' => $language_info['download_url'] . '&origin=piwigo_download',103 'IGNORED' => in_array($language_id, $conf['AU_ignore']['languages']),104 );105 }106 }107 }108 }109 110 $template->assign('update_plugins', $update_plugins);111 $template->assign('update_themes', $update_themes);112 $template->assign('update_languages', $update_languages);113 53 $template->assign('SHOW_RESET', (!empty($conf['AU_ignore']['plugins']) or !empty($conf['AU_ignore']['themes']) or !empty($conf['AU_ignore']['languages']))); 114 54 $template->assign('PWG_TOKEN', get_pwg_token());
Note: See TracChangeset
for help on using the changeset viewer.