-
Notifications
You must be signed in to change notification settings - Fork 1
/
sync-modpub.php
58 lines (47 loc) · 1.45 KB
/
sync-modpub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Copy and paste all needed files from DEV to Demo - for modpub directory
*
* @author Daniel Ancuta <[email protected]>
* @author Veikko Mäkinen <[email protected]>
*
* @copyright Authors
*
* @version 0.1
*/
/**
* Paths
*/
# Demo
$demoModpubPath = dirname(__FILE__).'/demo/pub/modpub';
# Dev
$modpubPath = dirname(__FILE__).'/modpub';
# Remove all files and directories from demo
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($demoModpubPath), RecursiveIteratorIterator::CHILD_FIRST);
for(; $iterator->valid(); $iterator->next()) {
$rdi = $iterator->getInnerIterator();
if ( (strpos( $rdi->getSubpathname(), '.svn' )!==false) || $iterator->isDot() ) {
continue;
}
if ( $rdi->isFile() ) {
unlink( $rdi->getPathname() );
} else {
rmdir( $rdi->getPathname() );
}
}
# Create our ADT dir in modpub :)
mkdir($demoModpubPath.'/Adt');
# Copy and paste all needed files from dev to demo
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($modpubPath), RecursiveIteratorIterator::SELF_FIRST);
for(; $iterator->valid(); $iterator->next()) {
$rdi = $iterator->getInnerIterator();
if ( (strpos( $rdi->getSubpathname(), '.svn' )!==false) || $iterator->isDot() ) {
continue;
}
if ( $rdi->isDir() ) {
mkdir($demoModpubPath.'/Adt/'.$rdi->getSubPathname());
} else {
copy( $rdi->getPathname(), $demoModpubPath.'/Adt/'.$rdi->getSubPathname() );
}
}
?>