Search
Search
Search
Search
Information
Information
Light
Dark
Open actions menu
Basic upload method
Bypass upload method
Tips!
If you encounter an error (by firewall) while uploading using both methods,
try changing extension of the file before uploading it and rename it right after.
This uploader supports multiple file upload.
Submit
~
var
www
podiocopy.bitkit.dk
httpdocs
app
Http
Controllers
Transfer
File Content:
MoveController.php
<?php namespace App\Http\Controllers\Transfer; /** * Created by PhpStorm. * User: jis * Date: 18/5/15 * Time: 4:36 PM */ use App\Http\Controllers\Controller; use App\Modules\Application\AppMoveRepo; use App\Modules\Application\AppToAppMoveRepo; use App\Modules\Auth\AuthRepository; use App\Modules\Configurations\Config; use App\Modules\GenModels\Estimate; use App\Modules\GenModels\MongoConnection; use App\Modules\GenModels\TransferQueue; use App\Modules\Logs\Helper; use App\Modules\OrganizationMove\OrganizationRepo; use App\Modules\WorkSpace\WorkSpaceMoveRepo; use Exception; use Input; use Log; use MongoDB\BSON\ObjectId; use MongoDB\Client; use MongoId; use PodioApp; use Response; use Auth; class MoveController extends Controller { public $collection; public function __construct(OrganizationRepo $organizationRepo) { $this->middleware('auth', ['except' => ['getStartTransferFromEstimate']]); $this->middleware('podioAuth', ['except' => ['getStartTransferFromEstimate']]); $this->organizationRepo = $organizationRepo; $this->authRepo = new AuthRepository(); } // public function getApp() // { // echo "<pre>"; // $userId = "5a38be38b50088241e28d80b"; // if ($this->authRepo->authenticateUser($userId)) { // try { // $item = PodioApp::get(18534237); // print_r($item); // } catch (Exception $e) { // print_r($e); // } // // } // } /** * Organization to Organization Move - Get an estimate * @return \Illuminate\View\View */ public function getOrganizationMoveEstimate() { $orgRepo = new OrganizationRepo(); log::info(Input::all()); if (Input::get('copyStructureOnly')) $copyStructureOnly = Input::get('copyStructureOnly'); $appStructureOnly = false; if (isset($copyStructureOnly) && $copyStructureOnly == 'true') $appStructureOnly = true; if (Input::get('source')) { $result = $orgRepo->getEstimate(Input::get('source'), $appStructureOnly); $discountRate = Config::checkDiscountUsers(Auth::user()->email); $totalAmount = $result['totalAmount']; if ($discountRate > 0) { $totalAmount = $totalAmount - ($totalAmount * $discountRate / 100); $totalAmount = Helper::formatNumber($totalAmount); } $result['estimateID'] = $orgRepo->saveOrganizationMoveEstimation( Input::get('source'), Input::get('destination'), Input::get('spaceUserNeeded'), $totalAmount, $appStructureOnly ); $result['appStructureOnly'] = false; return view('transfer.org_estimate', ['result' => $result]); } abort(404); return null; } public function getSpaceMoveEstimate() { $workspaceObj = new WorkSpaceMoveRepo(); $copyStructureOnly = Input::get('copyStructureOnly'); $appStructureOnly = false; if (isset($copyStructureOnly) && $copyStructureOnly == 'true') $appStructureOnly = true; $result = $workspaceObj->getEstimate( Input::get('spaces'), Input::get('source_org'), Input::get('destination_org'), Input::get('copyStructureOnly') ); $totalAmount = $result['totalAmount']; $discountRate = Config::checkDiscountUsers(Auth::user()->email); if ($discountRate > 0) { $totalAmount = $totalAmount - ($totalAmount * $discountRate / 100); $totalAmount = Helper::formatNumber($totalAmount); } $result['estimateID'] = $workspaceObj->getSaveSpaceMoveEstimate( Input::get('spaces'), Input::get('source_org'), Input::get('destination_org'), Input::get('spaceUserNeeded'), Input::get('copyStructureOnly'), $totalAmount ); $result['appStructureOnly'] = $appStructureOnly; return view('transfer.org_estimate', ['result' => $result]); } public function getAppMoveEstimate() { $appRepo = new AppMoveRepo(); $result = $appRepo->getEstimate(Input::get('apps'), false); $totalAmount = $result['totalAmount']; $discountRate = Config::checkDiscountUsers(Auth::user()->email); if ($discountRate > 0) { $totalAmount = $totalAmount - ($totalAmount * $discountRate / 100); $totalAmount = Helper::formatNumber($totalAmount); } $result['estimateID'] = $appRepo->getSaveAppMoveEstimate(Input::all(), $totalAmount); return view('transfer.app_estimate', ['result' => $result]); } public function getAppToAppMoveEstimate() { $appRepo = new AppToAppMoveRepo(); $result = $appRepo->getEstimate(Input::get('apps')); $result['estimateID'] = Input::get('queueId'); // save amount $totalAmount = $result['totalAmount']; $discountRate = Config::checkDiscountUsers(Auth::user()->email); if ($discountRate > 0) { $totalAmount = $totalAmount - ($totalAmount * $discountRate / 100); $totalAmount = Helper::formatNumber($totalAmount); } $model = new Estimate(); // $model->update(array('_id' => new MongoId($result['estimateID'])), array("amount" => $totalAmount)); $model->update(array('_id' => new ObjectId($result['estimateID'])), array("amount" => $totalAmount)); Log::info("estimateID"); Log::info($result['estimateID']); // $model = new Estimate(); // $estimate = $model->findOne(array('_id' => new MongoId(Input::get('queueId')))); // $userId = $estimate['user'] . ''; // if ($userId == "556c4e4a21b4d648635ce70d") // $result['totalAmount'] = '0.05'; return view('transfer.app_estimate', ['result' => $result]); } public function getStartTransferFromEstimate($estimateID) { Log::info("getStartTransferFromEstimate:" . $estimateID); $model = new Estimate(); $estimate = $model->findOne(array('_id' => new ObjectId($estimateID))); $transferModel = new TransferQueue(); $estimate['estimate_id'] = $estimateID; if ($estimate['type'] . '' == "app_to_app_move") { $queueID = $estimate['_id']; } else { if (isset($estimate['_id'])) unset($estimate['_id']); $queueID = $transferModel->create($estimate); } // start the process asynchronously $url = url() . '/move-async/start-queue/' . $queueID; $cmd = " wget -O /dev/null -o /dev/null -qb -t 1 --no-check-certificate " . $url; log::info($cmd); $pid = shell_exec($cmd); $model->update(array('_id' => new ObjectId($estimateID)), array('status' => 'started_transfer')); } public function postTrialTransfer($estimateID) { $model = new Estimate(); $estimate = $model->findOne(array('_id' => new ObjectId($estimateID))); if ($estimate['status'] == 'added_to_queue') { $transferModel = new TransferQueue(); $estimate['payment_type'] = "trial"; if ($estimate['type'] . '' == "app_to_app_move") { $queueID = $estimate['_id']; } else { if (isset($estimate['_id'])) unset($estimate['_id']); $queueID = $transferModel->create($estimate); } // start the process asynchronously $url = url() . '/move-async/start-queue/' . $queueID; $cmd = " wget -O /dev/null -o /dev/null -qb -t 1 --no-check-certificate " . $url; $pid = shell_exec($cmd); $model->update(array('_id' => new ObjectId($estimateID)), array('status' => 'started_transfer')); return view('transfer.payment-success'); } else { return view('transfer.error-trial'); } } /** * Save the process and return a status message */ // public function getSaveOrganizationMove() // { // $queueID = $this->organizationRepo->saveOrganizationMove(Input::get('source'), Input::get('destination')); // // // start the process asynchronously // $url = url() . '/move-async/start-queue/' . $queueID; // $cmd = " wget -O /dev/null -o /dev/null -qb -t 1 --no-check-certificate " . $url; // shell_exec($cmd); // // return Response::json( // array( // 'status' => 'success', // 'data' => "The moving process has started. //This may take awhile (up to several hours), depending on how much data you have in your Podio account. //Feel free to close the window - the moving will continue in the background. You can see the progress of your process in the dashboard." // ), // 200 // ); // } // public function getSaveSpaceMove() // { // $workspaceObj = new WorkSpaceMoveRepo(); // $queueID = $workspaceObj->getSaveSpaceMove(Input::get('spaces'), Input::get('source_org'), Input::get('destination_org')); // // // start the process asynchronously // $url = url() . '/move-async/start-queue/' . $queueID; // $cmd = " wget -O /dev/null -o /dev/null -qb -t 1 --no-check-certificate " . $url; // $pid = shell_exec($cmd); // // return Response::json( // array( // 'status' => 'success', // 'data' => "The moving process has started. //This may take awhile (up to several hours), depending on how much data you have in your Podio account. //Feel free to close the window - the moving will continue in the background. You can see the progress of your process in the dashboard." // ), // 200 // ); // } // public function getSaveAppMove() // { // $appRepo = new AppMoveRepo(); // $queueID = $appRepo->getSaveAppMove(Input::all()); // // // start the process asynchronously // $url = url() . '/move-async/start-queue/' . $queueID; // $cmd = " wget -O /dev/null -o /dev/null -qb -t 1 --no-check-certificate " . $url; // $pid = shell_exec($cmd); // // return Response::json( // array( // 'status' => 'success', // 'data' => "The moving process has started. //This may take awhile (up to several hours), depending on how much data you have in your Podio account. //Feel free to close the window - the moving will continue in the background. You can see the progress of your process in the dashboard." // ), // 200 // ); // } }
Edit
Download
Unzip
Chmod
Delete