@@ -56,10 +56,9 @@ function main($request, $compiler_config)
56
56
$ start_time = microtime (true );
57
57
58
58
// Step 0: Reject the request if the input data is not valid.
59
- //TODO: Replace $tmp variable name
60
- $ tmp = $ this ->requestValid ($ request );
61
- if ($ tmp ["success " ] === false )
62
- return $ tmp ;
59
+ $ tmpVar = $ this ->requestValid ($ request );
60
+ if ($ tmpVar ["success " ] === false )
61
+ return $ tmpVar ;
63
62
64
63
$ this ->set_variables ($ request , $ format , $ libraries , $ version , $ mcu , $ f_cpu , $ core , $ variant , $ vid , $ pid , $ compiler_config );
65
64
@@ -71,10 +70,10 @@ function main($request, $compiler_config)
71
70
72
71
// Step 1(part 1): Extract the project files included in the request.
73
72
$ files = array ();
74
- $ tmp = $ this ->extractFiles ($ request ["files " ], $ TEMP_DIR , $ compiler_dir , $ files ["sketch_files " ], "files " );
73
+ $ tmpVar = $ this ->extractFiles ($ request ["files " ], $ TEMP_DIR , $ compiler_dir , $ files ["sketch_files " ], "files " );
75
74
76
- if ($ tmp ["success " ] === false )
77
- return $ tmp ;
75
+ if ($ tmpVar ["success " ] === false )
76
+ return $ tmpVar ;
78
77
79
78
// Add the compiler temp directory to the compiler_config struct.
80
79
$ compiler_config ["compiler_dir " ] = $ compiler_dir ;
@@ -83,9 +82,9 @@ function main($request, $compiler_config)
83
82
$ files ["libs " ] = array ();
84
83
foreach ($ libraries as $ library => $ library_files ){
85
84
86
- $ tmp = $ this ->extractFiles ($ library_files , $ TEMP_DIR , $ compiler_dir , $ files ["libs " ][$ library ], "libraries/ $ library " , true );
87
- if ($ tmp ["success " ] === false )
88
- return $ tmp ;
85
+ $ tmpVar = $ this ->extractFiles ($ library_files , $ TEMP_DIR , $ compiler_dir , $ files ["libs " ][$ library ], "libraries/ $ library " , true );
86
+ if ($ tmpVar ["success " ] === false )
87
+ return $ tmpVar ;
89
88
}
90
89
91
90
if (!array_key_exists ("archive " , $ request ) || ($ request ["archive " ] !== false && $ request ["archive " ] !== true ))
@@ -100,20 +99,19 @@ function main($request, $compiler_config)
100
99
}
101
100
102
101
//Set logging to true if requested, and create the directory where logfiles are stored.
103
- //TODO: Replace $tmp variable name
104
- $ tmp = $ this ->setLoggingParams ($ request , $ compiler_config , $ TEMP_DIR , $ compiler_dir );
105
- if ($ tmp ["success " ] === false )
106
- return array_merge ($ tmp , ($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ARCHIVE_PATH ) : array ());
102
+ $ tmpVar = $ this ->setLoggingParams ($ request , $ compiler_config , $ TEMP_DIR , $ compiler_dir );
103
+ if ($ tmpVar ["success " ] === false )
104
+ return array_merge ($ tmpVar , ($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ARCHIVE_PATH ) : array ());
107
105
108
106
// Step 2: Preprocess Arduino source files.
109
- $ tmp = $ this ->preprocessIno ($ files ["sketch_files " ]);
110
- if ($ tmp ["success " ] === false )
111
- return array_merge ($ tmp , ($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ARCHIVE_PATH ) : array ());
107
+ $ tmpVar = $ this ->preprocessIno ($ files ["sketch_files " ]);
108
+ if ($ tmpVar ["success " ] === false )
109
+ return array_merge ($ tmpVar , ($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ARCHIVE_PATH ) : array ());
112
110
113
111
// Step 3: Preprocess Header includes and determine which core files directory(CORE_DIR) will be used.
114
- $ tmp = $ this ->preprocessHeaders ($ libraries , $ include_directories , $ compiler_dir , $ ARDUINO_CORES_DIR , $ EXTERNAL_CORES_DIR , $ CORE_DIR , $ CORE_OVERRIDE_DIR , $ version , $ core , $ variant );
115
- if ($ tmp ["success " ] === false )
116
- return array_merge ($ tmp , ($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ARCHIVE_PATH ) : array ());
112
+ $ tmpVar = $ this ->preprocessHeaders ($ libraries , $ include_directories , $ compiler_dir , $ ARDUINO_CORES_DIR , $ EXTERNAL_CORES_DIR , $ CORE_DIR , $ CORE_OVERRIDE_DIR , $ version , $ core , $ variant );
113
+ if ($ tmpVar ["success " ] === false )
114
+ return array_merge ($ tmpVar , ($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ARCHIVE_PATH ) : array ());
117
115
118
116
// Log the names of the project files and the libraries used in it.
119
117
if ($ format != "autocomplete " ) {
@@ -252,10 +250,10 @@ function main($request, $compiler_config)
252
250
flock ($ lock , LOCK_EX );
253
251
if (!file_exists ($ core_library )){
254
252
//makeCoresTmp scans the core files directory and return list including the urls of the files included there.
255
- $ tmp = $ this ->makeCoresTmp ($ CORE_DIR , $ CORE_OVERRIDE_DIR , $ TEMP_DIR , $ compiler_dir , $ files );
253
+ $ tmpVar = $ this ->makeCoresTmp ($ CORE_DIR , $ CORE_OVERRIDE_DIR , $ TEMP_DIR , $ compiler_dir , $ files );
256
254
257
- if (!$ tmp ["success " ]){
258
- return array_merge ($ tmp ,
255
+ if (!$ tmpVar ["success " ]){
256
+ return array_merge ($ tmpVar ,
259
257
($ ARCHIVE_OPTION ===true ) ? array ("archive " => $ ret ["archive " ]) : array (),
260
258
($ compiler_config ['logging ' ] === true ) ? array ("log " => $ ret ["log " ]) : array ());
261
259
}
@@ -382,26 +380,26 @@ function main($request, $compiler_config)
382
380
383
381
// Step 8: Convert the output to the requested format and measure its
384
382
// size.
385
- $ tmp = $ this ->convertOutput ("$ compiler_dir/files " , $ format , $ SIZE , $ SIZE_FLAGS , $ OBJCOPY , $ OBJCOPY_FLAGS , $ OUTPUT , $ start_time , $ compiler_config );
383
+ $ tmpVar = $ this ->convertOutput ("$ compiler_dir/files " , $ format , $ SIZE , $ SIZE_FLAGS , $ OBJCOPY , $ OBJCOPY_FLAGS , $ OUTPUT , $ start_time , $ compiler_config );
386
384
387
385
if ($ compiler_config ['logging ' ] === true ) {
388
386
$ log_content = @file_get_contents ($ compiler_config ['logFileName ' ]);
389
387
if (!$ log_content )
390
- $ tmp ["log " ] = "Failed to access logfile. " ;
388
+ $ tmpVar ["log " ] = "Failed to access logfile. " ;
391
389
else {
392
390
file_put_contents ($ compiler_config ["compiler_dir " ] . "/log " , $ log_content );
393
- $ tmp ["log " ] = $ log_content ;
391
+ $ tmpVar ["log " ] = $ log_content ;
394
392
}
395
393
}
396
394
397
395
if ($ ARCHIVE_OPTION === true ){
398
396
$ arch_ret = $ this ->createArchive ($ compiler_dir , $ TEMP_DIR , $ ARCHIVE_DIR , $ ARCHIVE_PATH );
399
397
if ($ arch_ret ["success " ] === false )
400
- $ tmp ["archive " ] = $ arch_ret ["message " ];
398
+ $ tmpVar ["archive " ] = $ arch_ret ["message " ];
401
399
else
402
- $ tmp ["archive " ] = $ ARCHIVE_PATH ;
400
+ $ tmpVar ["archive " ] = $ ARCHIVE_PATH ;
403
401
}
404
- return $ tmp ;
402
+ return $ tmpVar ;
405
403
}
406
404
407
405
private function requestValid (&$ request )
0 commit comments