Skip to content

Commit 8dab604

Browse files
committed
some code style cleanups
1 parent 4cefc14 commit 8dab604

File tree

4 files changed

+37
-14
lines changed

4 files changed

+37
-14
lines changed

admin.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* DokuWiki Plugin upgrade (Admin Component)
45
*
@@ -81,8 +82,22 @@ public function html()
8182
echo '<input type="hidden" name="do" value="admin" />';
8283
echo '<input type="hidden" name="page" value="upgrade" />';
8384
echo '<input type="hidden" name="sectok" value="' . getSecurityToken() . '" />';
84-
if ($next) echo '<button type="submit" name="step[' . $next . ']" value="1" class="button continue ' . $careful . '">' . $this->getLang('btn_continue') . ' ➡</button>';
85-
if ($abrt) echo '<button type="submit" name="step[cancel]" value="1" class="button abort">✖ ' . $this->getLang('btn_abort') . '</button>';
85+
if ($next) {
86+
echo '<button type="submit"
87+
name="step[' . $next . ']"
88+
value="1"
89+
class="button continue ' . $careful . '">' .
90+
$this->getLang('btn_continue') .
91+
' ➡</button>';
92+
}
93+
if ($abrt) {
94+
echo '<button type="submit"
95+
name="step[cancel]"
96+
value="1"
97+
class="button abort">✖ ' .
98+
$this->getLang('btn_abort') .
99+
'</button>';
100+
}
86101
echo '</form>';
87102

88103
$this->displayProgressBar($next);
@@ -180,7 +195,8 @@ private function nextStep(&$abrt, &$next, &$ok)
180195
* @param string $level
181196
* @param string $message
182197
*/
183-
public function log($level, $message) {
198+
public function log($level, $message)
199+
{
184200
echo '<div class="log-' . $level . '">' . $message . '</div>';
185201
flush();
186202
ob_flush();

cli.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
4+
35
use splitbrain\phpcli\Options;
46

57
require_once __DIR__ . '/vendor/autoload.php';
@@ -29,7 +31,7 @@ public function __construct()
2931
protected function setup(Options $options)
3032
{
3133
$options->setHelp(
32-
'This tool will upgrade your wiki to the newest release. It will automatically check file permissions '.
34+
'This tool will upgrade your wiki to the newest release. It will automatically check file permissions ' .
3335
'and download the required tarball. Internet access is required.'
3436
);
3537
$options->registerArgument('check|run', 'Either only check if an update can be done or do it', 'true');
@@ -73,7 +75,7 @@ public function log($level, $message, array $context = array())
7375
}
7476

7577
// run the script ourselves if called directly
76-
if(basename($_SERVER['SCRIPT_NAME']) == 'cli.php') {
78+
if (basename($_SERVER['SCRIPT_NAME']) == 'cli.php') {
7779
$cli = new cli_plugin_upgrade();
7880
$cli->run();
7981
}

helper.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* DokuWiki Plugin upgrade (Helper Component)
45
*
@@ -93,7 +94,7 @@ public function checkVersions()
9394
if (!$versionnum) {
9495
$this->log('warning', $this->getLang('vs_localno'));
9596
$ok = false;
96-
} else if ($tgzversionnum) {
97+
} elseif ($tgzversionnum) {
9798
if ($tgzversionnum < $versionnum) {
9899
$this->log('warning', $this->getLang('vs_newer'));
99100
$ok = false;
@@ -250,7 +251,8 @@ public function deleteObsoleteFiles()
250251
continue;
251252
}
252253

253-
if ((is_dir($file) && $this->recursiveDelete($file)) ||
254+
if (
255+
(is_dir($file) && $this->recursiveDelete($file)) ||
254256
@unlink($file)
255257
) {
256258
$this->log('info', $this->getLang('rm_done'), hsc($line));
@@ -330,10 +332,10 @@ private function traverseCheckAndCopy($dir, $dryrun)
330332
if ($fmd5 != $tmd5 || !file_exists($to)) {
331333
if ($dryrun) {
332334
// just check for writability
333-
if ((file_exists($to) && !is_writable($to)) ||
335+
if (
336+
(file_exists($to) && !is_writable($to)) ||
334337
(!file_exists($to) && is_dir(dirname($to)) && !is_writable(dirname($to)))
335338
) {
336-
337339
$this->log('error', '<b>' . $this->getLang('tv_noperm') . '</b>', hsc("$dir/$file"));
338340
$ok = false;
339341
} else {

legacy.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Legacy command line upgrade script
45
*
@@ -16,6 +17,7 @@
1617
* Only use this if you can't run the normal upgrade script.
1718
*/
1819

20+
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
1921

2022
require_once __DIR__ . '/vendor/autoload.php';
2123

@@ -28,7 +30,8 @@
2830
$conf['proxy'] = ['host' => '', 'port' => '', 'user' => '', 'pass' => '', 'ssl' => '', 'except' => ''];
2931
$conf['allowdebug'] = false;
3032

31-
function linesToHash($lines) {
33+
function linesToHash($lines)
34+
{
3235
$lines = array_map('trim', $lines);
3336
$lines = array_filter($lines);
3437
$lines = array_map(function ($item) {
@@ -44,7 +47,7 @@ function conf_decodeString($string)
4447

4548
function filesize_h($size)
4649
{
47-
return $size.'b';
50+
return $size . 'b';
4851
}
4952

5053
function hsc($string)
@@ -54,7 +57,7 @@ function hsc($string)
5457

5558
function io_mkdir_p($dir)
5659
{
57-
if(file_exists($dir)) return true;
60+
if (file_exists($dir)) return true;
5861
return mkdir($dir, 0777, true);
5962
}
6063

@@ -72,7 +75,7 @@ function getVersionData()
7275
function getVersion()
7376
{
7477
$version = getVersionData();
75-
return $version['type'].' '.$version['date'];
78+
return $version['type'] . ' ' . $version['date'];
7679
}
7780

7881
class Doku_Event
@@ -124,7 +127,7 @@ abstract class DokuWiki_CLI_Plugin extends splitbrain\phpcli\CLI
124127
use UpgradePluginTrait;
125128
}
126129

127-
class DokuWiki_Plugin
130+
class DokuWiki_Plugin
128131
{
129132
use UpgradePluginTrait;
130133
}

0 commit comments

Comments
 (0)