2014-05-09 19:06:08 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
OCP\JSON::callCheck();
|
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
|
|
|
|
$token = $_POST['token'];
|
|
|
|
$remote = $_POST['remote'];
|
|
|
|
$owner = $_POST['owner'];
|
|
|
|
$name = $_POST['name'];
|
|
|
|
$password = $_POST['password'];
|
|
|
|
|
|
|
|
$externalManager = new \OCA\Files_Sharing\External\Manager(
|
|
|
|
\OC::$server->getDatabaseConnection(),
|
|
|
|
\OC\Files\Filesystem::getMountManager(),
|
|
|
|
\OC\Files\Filesystem::getLoader(),
|
|
|
|
\OC::$server->getUserSession()
|
|
|
|
);
|
|
|
|
|
|
|
|
$mount = $externalManager->addShare($remote, $token, $password, $name, $owner);
|
2014-05-19 18:39:57 +04:00
|
|
|
/**
|
|
|
|
* @var \OCA\Files_Sharing\External\Storage $storage
|
|
|
|
*/
|
|
|
|
$storage = $mount->getStorage();
|
|
|
|
$result = $storage->file_exists('');
|
|
|
|
if($result){
|
|
|
|
$storage->getScanner()->scanAll();
|
|
|
|
}
|
2014-05-09 19:06:08 +04:00
|
|
|
|
|
|
|
echo json_encode($result);
|