This commit is contained in:
ruben- 2014-12-11 23:20:46 +01:00
parent e7289076c8
commit 2d0dff62b0
4 changed files with 59 additions and 47 deletions

View file

@ -744,7 +744,8 @@ class MainWPClientReport
jQuery(document).ready(function(){
var menu_update = jQuery('span.update-plugins');
var menu_count = jQuery('span.update-plugins > span.update-count');
if (menu_count) {
if (menu_count) {
var count = parseInt(menu_count.html());
if (count > 1) {
jQuery('span.update-plugins > span.update-count').each(function(){
jQuery(this).html(count - 1);

View file

@ -251,8 +251,13 @@ class TarArchiver
if (file_exists(rtrim($path, '/') . '/.htaccess')) $this->addFile(rtrim($path, '/') . '/.htaccess', rtrim(str_replace(ABSPATH, '', $path), '/') . '/mainwp-htaccess');
$iterator = new ExampleSortedIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD));
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD);
if (class_exists('ExampleSortedIterator'))
{
$iterator = new ExampleSortedIterator($iterator);
}
/** @var $path DirectoryIterator */
foreach ($iterator as $path)
@ -1210,57 +1215,59 @@ class TarArchiver
return null;
}
}
class ExampleSortedIterator extends SplHeap
if (class_exists('SplHeap'))
{
public function __construct(Iterator $iterator)
class ExampleSortedIterator extends SplHeap
{
foreach ($iterator as $item) {
$this->insert($item);
}
}
public function compare($b,$a)
{
$pathA = $a->__toString();
$pathB = $b->__toString();
$dirnameA = (is_file($pathA) ? dirname($pathA) : $pathA);
$dirnameB = (is_file($pathB) ? dirname($pathB) : $pathB);
//if both are in the same folder, first show the files, then the directories
if (dirname($pathA) == dirname($pathB))
public function __construct(Iterator $iterator)
{
if (is_file($pathA) && !is_file($pathB))
{
return -1;
}
else if (!is_file($pathA) && is_file($pathB))
{
return 1;
foreach ($iterator as $item) {
$this->insert($item);
}
}
public function compare($b,$a)
{
$pathA = $a->__toString();
$pathB = $b->__toString();
$dirnameA = (is_file($pathA) ? dirname($pathA) : $pathA);
$dirnameB = (is_file($pathB) ? dirname($pathB) : $pathB);
return strcmp($pathA, $pathB);
}
else if ($dirnameA == $dirnameB)
{
return strcmp($pathA, $pathB);
}
else if (MainWPHelper::startsWith($dirnameA, $dirnameB))
{
return 1;
}
else if (MainWPHelper::startsWith($dirnameB, $dirnameA))
{
return -1;
}
else
{
$cmp = strcmp($dirnameA, $dirnameB);
if ($cmp == 0)
//if both are in the same folder, first show the files, then the directories
if (dirname($pathA) == dirname($pathB))
{
if (is_file($pathA) && !is_file($pathB))
{
return -1;
}
else if (!is_file($pathA) && is_file($pathB))
{
return 1;
}
return strcmp($pathA, $pathB);
}
else if ($dirnameA == $dirnameB)
{
return strcmp($pathA, $pathB);
}
else if (MainWPHelper::startsWith($dirnameA, $dirnameB))
{
return 1;
}
else if (MainWPHelper::startsWith($dirnameB, $dirnameA))
{
return -1;
}
else
{
$cmp = strcmp($dirnameA, $dirnameB);
if ($cmp == 0)
{
return strcmp($pathA, $pathB);
}
return $cmp;
return $cmp;
}
}
}
}

View file

@ -5,7 +5,7 @@
Description: Child Plugin for MainWP. The plugin is used so the installed blog can be securely managed remotely by your network. Plugin documentation and options can be found here http://docs.mainwp.com
Author: MainWP
Author URI: http://mainwp.com
Version: 2.0.1
Version: 2.0.2
*/
header('X-Frame-Options: ALLOWALL');
//header('X-Frame-Options: GOFORIT');

View file

@ -7,7 +7,7 @@ Author URI: https://mainwp.com
Plugin URI: https://mainwp.com
Requires at least: 3.6
Tested up to: 4.1
Stable tag: 2.0.1
Stable tag: 2.0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -58,6 +58,10 @@ To see full documentation and FAQs please visit [MainWP Documentation](http://do
== Changelog ==
= 2.0.2 =
* Added: Support hosts with PHP Heap classes
* Fixed: Javascript issue disabling the popup menu on the admin menu
= 2.0.1 =
* Fixed: Restore/Clone from Tar via server upload