From 74e105b39a3687e21973e240164072d8901affc4 Mon Sep 17 00:00:00 2001 From: noackorama <noackorama@googlemail.com> Date: Wed, 29 Mar 2017 17:57:50 +0200 Subject: [PATCH] re #73 , show last upload date --- classes/MarketRelease.class.php | 12 +++++++++--- controllers/myplugins.php | 2 -- views/myplugins/_edit_release.php | 2 +- views/presenting/details.php | 2 +- views/presenting/overview_list.php | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/classes/MarketRelease.class.php b/classes/MarketRelease.class.php index 6286acc..22c9417 100755 --- a/classes/MarketRelease.class.php +++ b/classes/MarketRelease.class.php @@ -25,6 +25,7 @@ class MarketRelease extends SimpleORMap { 'on_delete' => 'delete', 'on_store' => 'store', ); + $config['additional_fields']['last_upload_time']['get'] = 'getFileMTime'; parent::configure($config); } @@ -101,16 +102,21 @@ class MarketRelease extends SimpleORMap { public function getContentLength() { - return filesize($this->getFilePath()); + return @filesize($this->getFilePath()); + } + + public function getFileMtime() + { + return @filemtime($this->getFilePath()); } public function getContent() { - return file_get_contents($this->getFilePath()); + return @file_get_contents($this->getFilePath()); } public function getChecksum() { - return md5_file($this->getFilePath()); + return @md5_file($this->getFilePath()); } public function getSecurityHash() { diff --git a/controllers/myplugins.php b/controllers/myplugins.php index 605ac6b..0dab406 100755 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -182,11 +182,9 @@ class MypluginsController extends MarketController } if (!Request::get("use_secret")) { $this->release['repository_secret'] = null; - $this->release['chdate'] = time(); } elseif(!$this->release['repository_secret']) { $this->release['repository_secret'] = md5(uniqid()); } - $this->release->installFile(); $this->release->store(); diff --git a/views/myplugins/_edit_release.php b/views/myplugins/_edit_release.php index 29ade29..cf115c9 100755 --- a/views/myplugins/_edit_release.php +++ b/views/myplugins/_edit_release.php @@ -40,7 +40,7 @@ <input type="text" name="release[repository_download_url]" value="<?= htmlReady($release['repository_download_url']) ?>"> </label> <label> - <input type="checkbox" name="use_secret"<? $release->isNew() || $release['repository_secret'] ? " checked" : "" ?> value="1"> + <input type="checkbox" name="use_secret" <?= $release->isNew() || $release['repository_secret'] ? " checked" : "" ?> value="1"> <?= _("Automatisches Update absichern über Sicherheitstoken (optional)") ?> </label> <p class="info"> diff --git a/views/presenting/details.php b/views/presenting/details.php index 37f1bbd..19755df 100755 --- a/views/presenting/details.php +++ b/views/presenting/details.php @@ -134,7 +134,7 @@ if ($image) { </td> <td><?= $release['studip_min_version'] ? htmlReady($release['studip_min_version']) : " - " ?></td> <td><?= $release['studip_max_version'] ? htmlReady($release['studip_max_version']) : " - " ?></td> - <td><?= strftime("%x", $release['mkdate']) ?></td> + <td><?= strftime("%x %R", $release['last_upload_time']) ?></td> <td><?= htmlReady($release->getChecksum()) ?></td> <td><?= htmlReady($release['downloads']) ?></td> <td class="actions"> diff --git a/views/presenting/overview_list.php b/views/presenting/overview_list.php index 68bf9a1..eb7cc2f 100755 --- a/views/presenting/overview_list.php +++ b/views/presenting/overview_list.php @@ -32,8 +32,8 @@ <td> <?= htmlReady($marketplugin->uses->count()) ?> </td> - <td data-sorter="<?= $marketplugin->releases->orderBy('chdate DESC')->val('mkdate') ?>"> - <?= strftime('%x', $marketplugin->releases->orderBy('chdate DESC')->val('mkdate')) ?> + <td data-sorter="<?= $marketplugin->releases->orderBy('last_upload_time DESC')->val('last_upload_time') ?>"> + <?= strftime('%x', $marketplugin->releases->orderBy('last_upload_time DESC')->val('last_upload_time')) ?> </td> <td> <?= htmlReady($marketplugin->getDownloads()) ?> -- GitLab