1- <?
2-
3- require ('../config.php ' );
4- $ benchmark_start = microtime_float ();
5-
6- // make troubleshooting page
7- $ source = CONTENTDIR ."static/tutorials/ " ;
8- $ path = BASEDIR ;
9-
10-
11- // update the files on the server via SVN
12-
13- // look for the .subversion folder somewhere else
14- // otherwise will go looking for /home/root/.subversion or some other user
15- $ where = CONTENTDIR . 'static/tutorials ' ;
16- putenv ('HOME= ' . CONTENTDIR );
1+ <?
172
3+ require ('../config.php ' );
4+ $ benchmark_start = microtime_float ();
5+
6+ // make troubleshooting page
7+ $ source = CONTENTDIR ."static/tutorials/ " ;
8+ $ path = BASEDIR ;
9+
10+
11+ // update the files on the server via SVN
12+
13+ // look for the .subversion folder somewhere else
14+ // otherwise will go looking for /home/root/.subversion or some other user
15+ $ where = CONTENTDIR . 'static/tutorials ' ;
16+ putenv ('HOME= ' . CONTENTDIR );
1817// From: http://code.google.com/p/processing/source/checkout
18+
1919// # Non-members may check out a read-only working copy anonymously over HTTP.
20+
2021// svn checkout http://processing.googlecode.com/svn/trunk/ processing-read-only
21-
22- // do the initial checkout
23- //`cd /var/www/processing && /usr/bin/svn checkout http://processing.googlecode.com/svn/trunk/web/content/`;
24-
25- `cd $ where && /usr/bin/svn update `;
26-
27- // Copy over the images for the tutorials index
28- if (!is_dir ($ path .'learning/imgs ' )) {
22+
23+ // do the initial checkout
24+ //`cd /var/www/processing && /usr/bin/svn checkout http://processing.googlecode.com/svn/trunk/web/content/`;
25+
26+ `cd $ where && /usr/bin/svn update `;
27+
28+ // Copy over the images for the tutorials index
29+ if (!is_dir ($ path .'learning/imgs ' )) {
30+
2931 mkdir ($ path .'learning/imgs ' , '0757 ' );
32+
3033}
31- if (is_dir ($ path .'learning/imgs ' )) {
32- copydirr ($ source .'imgs ' , $ path .'learning/imgs ' , null , 0757 , true );
33- }
3434
35- // Index page
35+ if (is_dir ($ path .'learning/imgs ' )) {
36+ copydirr ($ source .'imgs ' , $ path .'learning/imgs ' , null , 0757 , true );
3637
37- $ page = new Page ("Tutorials " , "Tutorials " );
38- $ page ->content (file_get_contents ($ source ."index.html " ));
39- writeFile ('learning/index.html ' , $ page ->out ());
38+ }
4039
40+ // Index page
41+ $ page = new Page ("Tutorials " , "Tutorials " );
42+ $ page ->content (file_get_contents ($ source ."index.html " ));
43+ writeFile ('learning/index.html ' , $ page ->out ());
4144
4245// Start making the individual tutorial pages
4346
44- //////////////// NOW WE WILL HAVE A LOOP TO DO INDIVIDUAL TUTORIALS /////////////
45- //////////////// BASED ON AN XML FILE TO READ /////////////
47+
48+
49+ // NOW WE WILL HAVE A LOOP TO DO INDIVIDUAL TUTORIALS
50+
51+ // BASED ON AN XML FILE TO READ
52+
4653
4754
4855if ( ! $ xml = simplexml_load_file ($ source .'tutorials.xml ' ) )
49- {
50- echo 'XML file missing ' ;
56+ {
57+
58+ echo 'XML file missing ' ;
59+
60+
5161}
5262else
53- {
54- foreach ( $ xml as $ tutorial )
55- {
56- $ title = $ tutorial -> title ;
57- $ directory = $ tutorial ->directory ;
58- $ imgs = $ tutorial ->imgs ;
59- $ code = $ tutorial ->code ;
60- echo ' About to generate tutorial ' . $ title . ' in directory ' . $ directory . ' , imgs dir = ' . $ imgs . ' , code dir = ' . $ code . ' <br \> ' ;
61- echo 'Copying ' .$ source . $ directory .'/index.html to ' . ' learning/ ' . $ directory . ' /index.html <br \> ' ;
62-
63- $ page = new Page ($ title , "Tutorials " );
64- $ page ->content (file_get_contents ($ source .$ directory .'/index.html ' ));
65- writeFile ('learning/ ' .$ directory .'/index.html ' , $ page ->out ());
66-
67- if ( $ imgs == ' true ' ) {
68- $ newpath = $ path . ' learning/ ' . $ directory . ' /imgs ' ;
69- if (! is_dir ( $ newpath)) {
70- mkdir ( $ newpath , ' 0757 ' );
71- }
72- if ( is_dir ( $ newpath)) {
73- copydirr ( $ source . $ directory . ' /imgs ' , $ newpath , null , 0757 , true );
74- }
75- }
76- if ( $ code == ' true ' ) {
77- $ newpath = $ path . ' learning/ ' . $ directory . ' /code ' ;
78- if (! is_dir ( $ newpath)) {
79- mkdir ( $ newpath , ' 0757 ' );
80- }
81- if ( is_dir ( $ newpath)) {
82- copydirr ( $ source . $ directory . ' /code ' , $ newpath , null , 0757 , true );
83- }
84- }
85- }
86- }
87- $ benchmark_end = microtime_float ();
88- $ execution_time = round ($ benchmark_end - $ benchmark_start , 4 );
89-
90- ?>
91-
92- <h2>Static page generation Successful</h2>
93- <h2>Updated <?= $ where?> </h2>
94- <p>Generated files in <?= $ execution_time?> seconds.</p>
95- <!--<p>Page put here: <?= $ source ."faq.html " ?> </p>-->
96- <!--<p>Page put here: <?= $ path .'faq.html ' ?> </p>-->
63+ {
64+
65+ foreach ( $ xml as $ tutorial )
66+ {
67+ $ title = $ tutorial ->title ;
68+ $ directory = $ tutorial ->directory ;
69+ $ imgs = $ tutorial ->imgs ;
70+ $ code = $ tutorial -> code ;
71+ echo 'About to generate tutorial ' .$ title . ' in directory ' . $ directory .', imgs dir = ' . $ imgs . ' , code dir = ' . $ code . ' <br \> ' ;
72+ echo ' Copying ' . $ source . $ directory . ' /index.html to ' . ' learning/ ' . $ directory . ' /index.html<br \> ' ;
73+ $ page = new Page ($ title , "Tutorials " );
74+ $ page ->content (file_get_contents ($ source .$ directory .'/index.html ' ));
75+ writeFile ('learning/ ' .$ directory .'/index.html ' , $ page ->out ());
76+ if ( $ imgs == ' true ' ) {
77+ $ newpath = $ path . ' learning/ ' . $ directory . ' /imgs ' ;
78+ if (! is_dir ( $ newpath)) {
79+ mkdir ( $ newpath, ' 0757 ' );
80+ }
81+ if ( is_dir ( $ newpath )) {
82+ copydirr ( $ source . $ directory . ' /imgs ' , $ newpath, null , 0757 , true );
83+ }
84+ }
85+ if ( $ code == ' true ' ) {
86+ $ newpath = $ path . ' learning/ ' . $ directory . ' /code ' ;
87+ if (! is_dir ( $ newpath)) {
88+ mkdir ( $ newpath, ' 0757 ' );
89+ }
90+ if ( is_dir ( $ newpath )) {
91+ copydirr ( $ source . $ directory . ' /code ' , $ newpath, null , 0757 , true );
92+ }
93+ }
94+ }
95+ }
96+
97+ $ benchmark_end = microtime_float ();
98+ $ execution_time = round ($ benchmark_end - $ benchmark_start , 4 );
99+
100+ ?>
101+
102+ <h2>Static page generation Successful</h2>
103+ <h2>Updated <?= $ where?> </h2>
104+ <p>Generated files in <?= $ execution_time?> seconds.</p>
105+ <!--<p>Page put here: <?= $ source ."faq.html " ?> </p>-->
106+ <!--<p>Page put here: <?= $ path .'faq.html ' ?> </p>-->
97107<!--<p><?= $ path .'learning/eclipse/imgs ' ?> </p>-->
0 commit comments