rmdir($file->getRealPath());
            continue;
        }
        unlink($file->getRealPath());
    }
    rmdir($directory);
}
$phpCodeSnifferDir = __DIR__ . '/vendor/squizlabs/php_codesniffer';
if (!file_exists($phpCodeSnifferDir)) {
    throw new \RuntimeException('Could not find PHP_CodeSniffer dependency. ' . 'Did you maybe forget to run "php composer.phar install --prefer-source --dev"?');
}
$sniffTestSuiteFile = $phpCodeSnifferDir . '/tests/Standards/AllSniffs.php';
if (!file_exists($sniffTestSuiteFile)) {
    throw new \RuntimeException('Could not find PHP_CodeSniffer test suite. ' . 'Did you maybe forget to run composer installation with option "--prefer-source"?');
}
require_once __DIR__ . '/vendor/autoload.php';
$calisthenicsStandardDir = $phpCodeSnifferDir . '/CodeSniffer/Standards/ObjectCalisthenics';
if (file_exists($calisthenicsStandardDir)) {
    removeDirectory($calisthenicsStandardDir);
}
mkdir($calisthenicsStandardDir);
mkdir($calisthenicsStandardDir . '/Sniffs');
mkdir($calisthenicsStandardDir . '/Tests');
copy(__DIR__ . '/LICENSE', $calisthenicsStandardDir . '/LICENSE');
copy(__DIR__ . '/ruleset.xml', $calisthenicsStandardDir . '/ruleset.xml');
copy(__DIR__ . '/DataStructureLengthSniff.php', $calisthenicsStandardDir . '/DataStructureLengthSniff.php');
copy(__DIR__ . '/IdentifierLengthSniff.php', $calisthenicsStandardDir . '/IdentifierLengthSniff.php');
copy(__DIR__ . '/PropertyTypePerClassLimitSniff.php', $calisthenicsStandardDir . '/PropertyTypePerClassLimitSniff.php');
copyDirectory(__DIR__ . '/Sniffs', $calisthenicsStandardDir . '/Sniffs');
copyDirectory(__DIR__ . '/Tests', $calisthenicsStandardDir . '/Tests');
Пример #2
0
    }
}
exec("mkdir -p ~/Downloads/spot_mini_debug");
$output = "DEBUG: ";
//
// check for library update in progress
if (file_exists($w->data() . "/update_library_in_progress")) {
    $w->result('', '', "Library update in progress", "", 'fileicon:' . $w->data() . '/update_library_in_progress', 'no', null, '');
    $output = $output . "Library update in progress: " . "the file" . $w->data() . "/update_library_in_progress is present\n";
}
if (!file_exists($w->data() . "/settings.json")) {
    $output = $output . "The file " . $w->data() . "/settings.json is not present\n";
} else {
    copy($w->data() . "/settings.json", $w->home() . "/Downloads/spot_mini_debug/settings.json");
}
copyDirectory($w->cache(), $w->home() . "/Downloads/spot_mini_debug/cache");
if (!file_exists($w->data() . "/fetch_artworks.db")) {
    $output = $output . "The file " . $w->data() . "/fetch_artworks.db is not present\n";
} else {
    copy($w->data() . "/fetch_artworks.db", $w->home() . "/Downloads/spot_mini_debug/fetch_artworks.db");
}
if (!file_exists($w->data() . "/library.db")) {
    $output = $output . "The file " . $w->data() . "/library.db is not present\n";
} else {
    copy($w->data() . "/library.db", $w->home() . "/Downloads/spot_mini_debug/library.db");
}
if (!file_exists($w->data() . "/library_new.db")) {
    $output = $output . "The file " . $w->data() . "/library_new.db is not present\n";
} else {
    copy($w->data() . "/library_new.db", $w->home() . "/Downloads/spot_mini_debug/library_new.db");
}
Пример #3
0
/**
 * copyDirectory function.
 *
 * @access public
 * @param mixed $source
 * @param mixed $destination
 * @return void
 */
function copyDirectory($source, $destination)
{
    if (is_dir($source)) {
        @mkdir($destination);
        $directory = dir($source);
        while (FALSE !== ($readdirectory = $directory->read())) {
            if ($readdirectory == '.' || $readdirectory == '..') {
                continue;
            }
            $PathDir = $source . '/' . $readdirectory;
            if (is_dir($PathDir)) {
                copyDirectory($PathDir, $destination . '/' . $readdirectory);
                continue;
            }
            copy($PathDir, $destination . '/' . $readdirectory);
        }
        $directory->close();
    } else {
        copy($source, $destination);
    }
}
Пример #4
0
<?php

header('content-type:text/html;charset=utf-8');
function copyDirectory($src, $dst)
{
    if (!file_exists($src) || file_exists($dst)) {
        return false;
    }
    mkdir($dst);
    $handle = opendir($src);
    while (($item = readdir($handle)) !== FALSE) {
        if ($item != '.' && $item != '..') {
            if (is_file($src . '/' . $item)) {
                copy($src . '/' . $item, $dst . '/' . $item);
            } else {
                $func = __FUNCTION__;
                $func($src . '/' . $item, $dst . '/' . $item);
            }
        }
    }
    closedir($handle);
}
$src = 'images';
$dst = 'abc';
copyDirectory($src, $dst);