Skip to content

Commit 37fa6a8

Browse files
committed
Change directory hierarchy
* Adapted by: @eloimuns
1 parent 72c0119 commit 37fa6a8

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A simple OTA REST Server for CyanogenMod OTA Updater System Application
77
4. Optional. If just want to test if the REST Server is working, if you go to [http://localhost/CyanogenModOTA](http://localhost/CyanogenModOTA/) you'll be redirected to the builds directory listing.
88

99
## Where do I have to upload the ZIPs that I obtain after the compilation?
10-
- Full builds should be uploaded to `builds/full` directory.
10+
- Full builds should be uploaded to `builds/$device/$channel` directory.
1111
- Delta builds will be automatically built on the `builds/delta` directory.
1212

1313
## Can I Debug my REST Server somehow?

src/Helpers/Builds.php

+23-12
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,29 @@ public function getDelta() {
103103

104104
private function getBuilds() {
105105
// Get physical paths of where the files resides
106-
$path = Flight::cfg()->get('realBasePath') . '/builds/full';
107-
// Get the file list and parse it
108-
$files = preg_grep( '/^([^.Thumbs])/', scandir( $path ) );
109-
if ( count( $files ) > 0 ) {
110-
foreach ( $files as $file ) {
111-
$build = new Build( $file, $path);
112-
113-
if ( $build->isValid( $this->postData['params'] ) ) {
114-
array_push( $this->builds , $build );
115-
}
116-
}
117-
}
106+
if ($this->postData['params'] != NULL){
107+
$tmp_device = $this->postData['params']['device'];
108+
$tmp_channels = $this->postData['params']['channels'];
109+
110+
if (in_array('stable', $tmp_channels) || in_array('nightly', $tmp_channels)){
111+
$path = Flight::cfg()->get('realBasePath') . '/builds/'.$tmp_device.'/nightly';
112+
if (file_exists($path)){
113+
// Get the file list and parse it
114+
$files = preg_grep( '/^([^.Thumbs])/', scandir( $path ) );
115+
if ( count( $files ) > 0 ) {
116+
foreach ( $files as $file ) {
117+
if (strpos($file, 'md5sum') === false){
118+
$build = new Build( $file, $path);
119+
120+
if ( $build->isValid( $this->postData['params'] ) ) {
121+
array_push( $this->builds , $build );
122+
}
123+
}
124+
}
125+
}
126+
}
127+
}
128+
}
118129
}
119130

120131
}

0 commit comments

Comments
 (0)