Skip to content

Commit

Permalink
Merge pull request #125 from austintoddj/analysis-8nKv3G
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
austintoddj authored Aug 15, 2016
2 parents 86a4534 + 37a492b commit f6d5048
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/Backend/HomeController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace App\Http\Controllers\Backend;

use App\Http\Controllers\Controller;
Expand Down
30 changes: 19 additions & 11 deletions app/Http/Controllers/Backend/ToolsController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace App\Http\Controllers\Backend;

use Excel;
Expand Down Expand Up @@ -36,6 +37,7 @@ public function index()
'timezone' => $_SERVER['APP_TIMEZONE'],
'status' => $status,
];

return view('backend.tools.index', compact('data'));
}

Expand All @@ -52,6 +54,7 @@ public function resetIndex()
} else {
Session::set('_reset-index', trans('messages.reset_index_error'));
}

return redirect(url('admin/tools'));
}

Expand All @@ -70,6 +73,7 @@ public function clearCache()
} else {
Session::set('_cache-clear', trans('messages.cache_clear_error'));
}

return redirect(url('admin/tools'));
}

Expand All @@ -87,7 +91,7 @@ public function handleDownload()
$this->storeMigrations();
$this->storeUploads();
$date = date('Y-m-d');
$path = storage_path($date . '-canvas-archive');
$path = storage_path($date.'-canvas-archive');
$filename = sprintf('%s.zip', $path);
$zip = new \ZipArchive();
$zip->open($filename, \ZipArchive::CREATE);
Expand All @@ -96,15 +100,16 @@ public function handleDownload()
\RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => $file) {
if (!$file->isDir()) {
if (! $file->isDir()) {
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($path) + 1);
$zip->addFile($filePath, $relativePath);
}
}
$zip->close();
\File::deleteDirectory(storage_path($date . '-canvas-archive'));
return response()->download(storage_path($date . '-canvas-archive.zip'))->deleteFileAfterSend(true);
\File::deleteDirectory(storage_path($date.'-canvas-archive'));

return response()->download(storage_path($date.'-canvas-archive.zip'))->deleteFileAfterSend(true);
}

protected function storeUsers()
Expand All @@ -117,7 +122,7 @@ protected function storeUsers()
$sheet->appendRow($user);
}
});
})->store('csv', storage_path($this->date . '-canvas-archive'), true);
})->store('csv', storage_path($this->date.'-canvas-archive'), true);
}

protected function storePosts()
Expand All @@ -132,7 +137,7 @@ protected function storePosts()
$sheet->appendRow($post);
}
});
})->store('csv', storage_path($this->date . '-canvas-archive'), true);
})->store('csv', storage_path($this->date.'-canvas-archive'), true);
}
}

Expand All @@ -148,7 +153,7 @@ protected function storeTags()
$sheet->appendRow($tag);
}
});
})->store('csv', storage_path($this->date . '-canvas-archive'), true);
})->store('csv', storage_path($this->date.'-canvas-archive'), true);
}
}

Expand All @@ -164,7 +169,7 @@ protected function storePostTag()
$sheet->appendRow($pt);
}
});
})->store('csv', storage_path($this->date . '-canvas-archive'), true);
})->store('csv', storage_path($this->date.'-canvas-archive'), true);
}
}

Expand All @@ -178,13 +183,14 @@ protected function storeMigrations()
$sheet->appendRow($migration);
}
});
})->store('csv', storage_path($this->date . '-canvas-archive'), true);
})->store('csv', storage_path($this->date.'-canvas-archive'), true);
}

protected function storeUploads()
{
$source = public_path() . '/uploads/';
$destination = storage_path($this->date . '-canvas-archive/uploads/');
$source = public_path().'/uploads/';
$destination = storage_path($this->date.'-canvas-archive/uploads/');

return \File::copyDirectory($source, $destination);
}

Expand All @@ -202,6 +208,7 @@ public function enableMaintenanceMode()
} else {
Session::set('_enable-maintenance-mode', trans('messages.enable_maintenance_mode_error'));
}

return redirect(url('admin/tools'));
}

Expand All @@ -218,6 +225,7 @@ public function disableMaintenanceMode()
} else {
Session::set('_disable-maintenance-mode', trans('messages.disable_maintenance_mode_error'));
}

return redirect(url('admin/tools'));
}
}

0 comments on commit f6d5048

Please sign in to comment.