Skip to content

Commit

Permalink
optional prefix when working with gdrive folder id
Browse files Browse the repository at this point in the history
  • Loading branch information
fensoft committed Oct 14, 2017
1 parent e64dc35 commit 1cb5c2c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/php/gdrive.protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
require_once dirname(__FILE__) . '/../../core/php/datatransfert.inc.php';

class gdrive extends Fly {
function __construct($_clientId, $_clientSecret, $_accessToken, $_truePath) {
function __construct($_clientId, $_clientSecret, $_accessToken, $_truePath, $_prefixPath) {
$this->clientId = $_clientId;
$this->clientSecret = $_clientSecret;
$this->accessToken = $_accessToken;
$this->truePath = $_truePath;
$this->prefixPath = $_prefixPath;
$this->forceBase = false;
$this->removeDupes = true;
}
Expand All @@ -36,7 +37,8 @@ static function withEqLogic($_eqLogic) {
return new self($_eqLogic->getConfiguration('clientId'),
$_eqLogic->getConfiguration('clientSecret'),
$_eqLogic->getConfiguration('accessToken'),
($_eqLogic->getConfiguration('truePath') == 1) ? true : false);
($_eqLogic->getConfiguration('truePath') == 1) ? true : false,
($_eqLogic->getConfiguration('prefixPath') == 1) ? true : false);
}

function getFly($_base) {
Expand All @@ -56,7 +58,11 @@ function put($_source, $_cible) {
$id = $this->mkdir(dirname($_cible));
parent::put($_source, $id . "/" . basename($_cible));
} else {
parent::put($_source, explode("/", $_cible)[0] . "/" . implode("_", array_slice(explode("/", $_cible), 1)));
if ($this->prefixPath)
$basename = implode("_", array_slice(explode("/", $_cible), 1));
else
$basename = basename($_cible);
parent::put($_source, explode("/", $_cible)[0] . "/" . $basename);
}
}

Expand Down
6 changes: 6 additions & 0 deletions desktop/modal/gdrive.configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
<label class="checkbox-inline"><input type="checkbox" class="eqLogicAttr" data-l1key="configuration" data-l2key="truePath" checked/>{{Oui: chemin}}<br/>{{Non: folderid}}</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{{Préfixer par le path dans le nom}}</label>
<div class="col-sm-4">
<label class="checkbox-inline"><input type="checkbox" class="eqLogicAttr" data-l1key="configuration" data-l2key="prefixPath"/>{{Oui: path_nom.txt}}<br/>{{Non: nom.txt}}</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{{Progression précise}}</label>
<div class="col-sm-4">
Expand Down

0 comments on commit 1cb5c2c

Please sign in to comment.