Lines Matching +full:update +full:- +full:user +full:- +full:info -(+path:inc +path:lang) -(+path:lib +path:plugins +path:lang) -(+path:lib +path:tpl +path:dokuwiki +path:lang)

6  * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
7 * @author Michael Hamann <michael@content-space.de>
44 $this->tpllib = dirname(tpl_incdir()) . '/';
54 foreach ($this->temporary as $dir) {
76 $this->id = $id;
78 $this->base = $id;
81 $this->base = substr($id, 9);
82 $this->is_template = true;
84 $this->is_template = false;
87 $this->localInfo = [];
88 $this->managerData = [];
89 $this->remoteInfo = [];
91 if ($this->isInstalled()) {
92 $this->readLocalData();
93 $this->readManagerData();
96 if ($this->repository == null) {
97 $this->repository = $this->loadHelper('extension_repository');
100 $this->remoteInfo = $this->repository->getData($this->getID());
102 return ($this->localInfo || $this->remoteInfo);
112 return is_dir($this->getInstallDir());
122 if (!$this->isInstalled()) return false;
123 return file_exists($this->getInstallDir() . '/.git');
133 if (!empty($this->remoteInfo['bundled'])) return $this->remoteInfo['bundled'];
135 $this->id,
144 'info',
166 if ($this->id == $conf['authtype']) return true;
170 $cascade = $plugin_controller->getCascade();
171 return (isset($cascade['protected'][$this->id]) && $cascade['protected'][$this->id]);
181 return $this->base != $this->getBase();
192 if ($this->isTemplate()) {
193 return ($conf['template'] == $this->getBase());
198 return $plugin_controller->isEnabled($this->base);
204 * @return bool If an update is available
208 if (!$this->isInstalled()) return false;
209 if ($this->isBundled()) return false;
210 $lastupdate = $this->getLastUpdate();
212 $installed = $this->getInstalledVersion();
213 if ($installed === false || $installed === $this->getLang('unknownversion')) return true;
214 return $this->getInstalledVersion() < $this->getLastUpdate();
224 return $this->is_template;
236 return $this->id;
246 return $this->base;
249 // Data from plugin.info.txt/template.info.txt or the repo when not available locally
257 if (!empty($this->localInfo['base'])) return $this->localInfo['base'];
258 return $this->base;
268 if (!empty($this->localInfo['name'])) return $this->localInfo['name'];
269 if (!empty($this->remoteInfo['name'])) return $this->remoteInfo['name'];
270 return $this->base;
280 if (!empty($this->localInfo['author'])) return $this->localInfo['author'];
281 if (!empty($this->remoteInfo['author'])) return $this->remoteInfo['author'];
293 if (!empty($this->localInfo['email'])) return $this->localInfo['email'];
304 if (!empty($this->remoteInfo['emailid'])) return $this->remoteInfo['emailid'];
305 if (!empty($this->localInfo['email'])) return md5($this->localInfo['email']);
316 if (!empty($this->localInfo['desc'])) return $this->localInfo['desc'];
317 if (!empty($this->remoteInfo['description'])) return $this->remoteInfo['description'];
328 if (!empty($this->localInfo['url'])) return $this->localInfo['url'];
330 ($this->isTemplate() ? 'template' : 'plugin') . ':' . $this->getBase();
336 * @return string|bool The version, usually in the form yyyy-mm-dd if there is any
340 if (!empty($this->localInfo['date'])) return $this->localInfo['date'];
341 if ($this->isInstalled()) return $this->getLang('unknownversion');
348 * @return string|bool The date of the last update or false if not available
352 if (!empty($this->managerData['updated'])) return $this->managerData['updated'];
353 return $this->getInstallDate();
363 if (!empty($this->managerData['installed'])) return $this->managerData['installed'];
374 if (!empty($this->remoteInfo['dependencies'])) return $this->remoteInfo['dependencies'];
387 $dependencies = $this->getDependencies();
390 if (!$plugin_controller->isEnabled($dependency)) {
404 if (!empty($this->remoteInfo['conflicts'])) return $this->remoteInfo['conflicts'];
415 if (!empty($this->remoteInfo['similar'])) return $this->remoteInfo['similar'];
426 if (!empty($this->remoteInfo['tags'])) return $this->remoteInfo['tags'];
437 if (!empty($this->remoteInfo['popularity'])) return $this->remoteInfo['popularity'];
442 * Get the text of the update message if there is any
444 * @return string|bool The update message if there is any, false otherwise
448 if (!empty($this->remoteInfo['updatemessage'])) return $this->remoteInfo['updatemessage'];
459 if (!empty($this->remoteInfo['securitywarning'])) return $this->remoteInfo['securitywarning'];
470 if (!empty($this->remoteInfo['securityissue'])) return $this->remoteInfo['securityissue'];
481 if (!empty($this->remoteInfo['screenshoturl'])) return $this->remoteInfo['screenshoturl'];
492 if (!empty($this->remoteInfo['thumbnailurl'])) return $this->remoteInfo['thumbnailurl'];
502 if (!empty($this->managerData['downloadurl'])) return $this->managerData['downloadurl'];
513 if (!empty($this->remoteInfo['downloadurl'])) return $this->remoteInfo['downloadurl'];
524 $lasturl = $this->getLastDownloadURL();
525 $currenturl = $this->getDownloadURL();
536 if (!empty($this->remoteInfo['bugtracker'])) return $this->remoteInfo['bugtracker'];
547 if (!empty($this->remoteInfo['sourcerepo'])) return $this->remoteInfo['sourcerepo'];
558 if (!empty($this->remoteInfo['donationurl'])) return $this->remoteInfo['donationurl'];
569 if (!empty($this->remoteInfo['types'])) return $this->remoteInfo['types'];
570 if ($this->isTemplate()) return [32 => 'template'];
577 * @return array The versions in the form yyyy-mm-dd => ('label' => label, 'implicit' => implicit)
581 if (!empty($this->remoteInfo['compatible'])) return $this->remoteInfo['compatible'];
586 * Get the date of the last available update
588 * @return string|bool The last available update in the form yyyy-mm-dd if there is any, false otherwise
592 if (!empty($this->remoteInfo['lastupdate'])) return $this->remoteInfo['lastupdate'];
603 if ($this->isTemplate()) {
604 return $this->tpllib . $this->base;
606 return DOKU_PLUGIN . $this->base;
617 if (!$this->isInstalled()) return 'none';
618 if (!empty($this->managerData)) return 'automatic';
619 if (is_dir($this->getInstallDir() . '/.git')) return 'git';
630 if ($this->isInstalled()) {
631 if (!is_writable($this->getInstallDir())) {
636 if ($this->isTemplate() && !is_writable($this->tpllib)) {
645 * Install an extension from a user upload
655 throw new Exception($this->getLang('msg_upload_failed') . ' (' . $_FILES[$field]['error'] . ')');
658 $tmp = $this->mkTmpDir();
659 if (!$tmp) throw new Exception($this->getLang('error_dircreate'));
667 throw new Exception($this->getLang('msg_upload_failed'));
669 $installed = $this->installArchive("$tmp/upload.archive", $overwrite, $basename);
670 $this->updateManagerData('', $installed);
671 $this->removeDeletedfiles($installed);
672 $this->purgeCache();
686 $path = $this->download($url);
687 $installed = $this->installArchive($path, $overwrite);
688 $this->updateManagerData($url, $installed);
689 $this->removeDeletedfiles($installed);
690 $this->purgeCache();
695 * Install or update the extension
702 $url = $this->getDownloadURL();
703 $path = $this->download($url);
704 $installed = $this->installArchive($path, $this->isInstalled(), $this->getBase());
705 $this->updateManagerData($url, $installed);
708 if (!isset($installed[$this->getID()])) {
711 $this->removeDeletedfiles($installed);
712 $this->setExtension($this->getID());
713 $this->purgeCache();
724 $this->purgeCache();
725 return io_rmdir($this->getInstallDir(), true);
735 if ($this->isTemplate()) return $this->getLang('notimplemented');
736 if (!$this->isInstalled()) return $this->getLang('notinstalled');
737 if ($this->isEnabled()) return $this->getLang('alreadyenabled');
741 if ($plugin_controller->enable($this->base)) {
742 $this->purgeCache();
745 return $this->getLang('pluginlistsaveerror');
756 if ($this->isTemplate()) return $this->getLang('notimplemented');
760 if (!$this->isInstalled()) return $this->getLang('notinstalled');
761 if (!$this->isEnabled()) return $this->getLang('alreadydisabled');
762 if ($plugin_controller->disable($this->base)) {
763 $this->purgeCache();
766 return $this->getLang('pluginlistsaveerror');
783 * Read local extension data either from info.txt or getInfo()
787 if ($this->isTemplate()) {
788 $infopath = $this->getInstallDir() . '/template.info.txt';
790 $infopath = $this->getInstallDir() . '/plugin.info.txt';
794 $this->localInfo = confToHash($infopath);
795 } elseif (!$this->isTemplate() && $this->isEnabled()) {
796 $path = $this->getInstallDir() . '/';
801 $plugin = plugin_load($type, $this->base);
809 $plugin = plugin_load($type, $this->base . '_' . substr($cp, 0, -4));
818 $this->localInfo = $plugin->getInfo();
831 $origID = $this->getID();
838 if ($this->getID() != $ext) $this->setExtension($ext);
840 $this->managerData['downloadurl'] = $url;
841 } elseif (isset($this->managerData['downloadurl'])) {
842 unset($this->managerData['downloadurl']);
844 if (isset($this->managerData['installed'])) {
845 $this->managerData['updated'] = date('r');
847 $this->managerData['installed'] = date('r');
849 $this->writeManagerData();
852 if ($this->getID() != $origID) $this->setExtension($origID);
860 $managerpath = $this->getInstallDir() . '/manager.dat';
870 $this->managerData[$key] = $value;
881 $managerpath = $this->getInstallDir() . '/manager.dat';
883 foreach ($this->managerData as $k => $v) {
900 $this->temporary[] = $dir;
907 * - $file is the directory where the file should be saved
908 * - if successful will return the name used for the saved file, false otherwise
922 $http->max_bodysize = 0;
923 $http->timeout = 25; //max. 25 sec
924 $http->keep_alive = false; // we do single ops here, no need for keep-alive
925 $http->agent = 'DokuWiki HTTP Client (Extension Manager)';
927 $data = $http->get($url);
931 if (isset($http->resp_headers['content-disposition'])) {
932 $content_disposition = $http->resp_headers['content-disposition'];
969 throw new Exception($this->getLang('error_badurl'));
981 if (!($tmp = $this->mkTmpDir())) {
982 throw new Exception($this->getLang('error_dircreate'));
986 if (!$file = $this->downloadToFile($url, $tmp . '/', $file)) {
989 $this->getLang('error_download'),
1009 if (!($tmp = $this->mkTmpDir())) {
1010 throw new Exception($this->getLang('error_dircreate'));
1015 throw new Exception($this->getLang('error_dircreate'));
1019 $this->decompress($file, "$tmp/" . $base);
1024 $default = ($this->isTemplate() ? 'template' : 'plugin');
1025 if (!$this->findFolders($result, $tmp . '/' . $base, $default)) {
1026 throw new Exception($this->getLang('error_findfolder'));
1037 throw new Exception($this->getLang('error_findfolder'));
1044 $target_base_dir = $this->tpllib;
1050 // use base set in info.txt
1054 // default - use directory as found in zip
1055 // plugins from github/master without *.info.txt will install in wrong folder
1056 // but using $info->id will make 'code3' fail (which should install in lib/code/..)
1063 // this info message is not being exposed via exception,
1065 msg(sprintf($this->getLang('msg_nooverwrite'), $item['base']));
1069 $action = file_exists($target) ? 'update' : 'install';
1072 if ($this->dircopy($item['tmp'], $target)) {
1073 // return info
1085 $this->getLang('error_copy') . DOKU_LF,
1103 * Correct folders are searched recursively using the "*.info.txt" configs
1115 * @param array $result - results are stored here
1116 * @param string $directory - the temp directory where the package was unpacked to
1117 * @param string $default_type - type used if no info.txt available
1118 * @param string $subdir - a subdirectory. do not set. used by recursion
1119 * @return bool - false on error
1136 // it's a file -> check for config
1139 case 'plugin.info.txt':
1140 case 'template.info.txt':
1142 $info = [];
1144 $info['type'] = $type[0];
1145 $info['tmp'] = $this_dir;
1147 $info['base'] = basename($conf['base']);
1148 $result['new'][] = $info;
1162 // files where found but no info.txt - use old method
1164 $info = [];
1165 $info['tmp'] = $this_dir;
1168 $info['type'] = 'template';
1170 $info['type'] = $default_type;
1173 $result['old'][] = $info;
1177 // we have no files yet -> recurse
1179 $this->findFolders($result, $directory, $default_type, "$found_dir");
1197 if (str_ends_with($target, '/')) $target = substr($target, 0, -1);
1199 $ext = $this->guessArchiveType($file);
1203 $tar->open($file);
1204 $tar->extract($target);
1206 throw new Exception($this->getLang('error_decompress') . ' ' . $e->getMessage(), $e->getCode(), $e);
1213 $zip->open($file);
1214 $zip->extract($target);
1216 throw new Exception($this->getLang('error_decompress') . ' ' . $e->getMessage(), $e->getCode(), $e);
1224 throw new Exception($this->getLang('error_decompress') . ' Couldn\'t read archive file');
1251 * Copy with recursive sub-directory support
1267 $ok = $this->dircopy("$src/$f", "$dst/$f");
1292 // only on update
1297 $extensiondir = $this->tpllib;