@@ -31,43 +31,39 @@ static function load()
31
31
}
32
32
33
33
$ lang = trim ( file_get_contents ( $ file ) );
34
- $ cache = __DIR__ . "/../../../temp/qaxml.files. $ lang " ;
34
+ $ cacheFilename = __DIR__ . "/../../../temp/qaxml.files. $ lang " ;
35
35
36
- if ( file_exists ( $ cache ) )
36
+ if ( file_exists ( $ cacheFilename ) )
37
37
{
38
- $ data = file_get_contents ( $ cache );
39
- return unserialize ( gzdecode ( $ data ) );
38
+ return unserialize ( gzdecode ( file_get_contents ( $ cacheFilename ) ) );
40
39
}
41
40
41
+ $ sourceDir = 'en ' ;
42
+ $ targetDir = $ lang ;
43
+
42
44
require_once __DIR__ . '/../lib/all.php ' ;
43
45
44
- $ revcheck = new RevcheckRun ( 'en ' , $ lang );
45
- $ revdata = $ revcheck ->revData ;
46
- $ list = [];
46
+ $ files = new RevcheckFileList ( $ sourceDir );
47
+ $ syncFileItems = [];
47
48
48
- foreach ( $ revdata -> fileDetail as $ file )
49
+ foreach ( $ files -> iterator () as $ file )
49
50
{
50
- $ source = "{$ revcheck ->sourceDir }/ {$ file ->path }/ {$ file ->name }" ;
51
- $ target = "{$ revcheck ->targetDir }/ {$ file ->path }/ {$ file ->name }" ;
52
-
53
- if ( ! file_exists ( $ source ) )
54
- continue ;
55
- if ( ! file_exists ( $ target ) )
51
+ if ( ! file_exists ( "$ targetDir/ {$ file ->file }" ) )
56
52
continue ;
57
53
58
54
$ item = new SyncFileItem ();
59
- $ item ->sourceDir = $ revcheck -> sourceDir ;
60
- $ item ->targetDir = $ revcheck -> targetDir ;
61
- $ item ->file = $ file ->path . ' / ' . $ file-> name ;
62
- $ list [] = $ item ;
55
+ $ item ->sourceDir = $ sourceDir ;
56
+ $ item ->targetDir = $ targetDir ;
57
+ $ item ->file = $ file ->file ;
58
+ $ ret [] = $ item ;
63
59
}
64
60
65
- if ( count ( $ list ) == 0 )
61
+ if ( $ syncFileItems === [] )
66
62
throw new Exception ( "No files found. Called from wrong directory? " );
67
63
68
- $ contents = gzencode ( serialize ( $ list ) );
69
- file_put_contents ( $ cache , $ contents );
64
+ $ contents = gzencode ( serialize ( $ ret ) );
65
+ file_put_contents ( $ cacheFilename , $ contents );
70
66
71
- return $ list ;
67
+ return $ ret ;
72
68
}
73
69
}
0 commit comments