/** * @param .OC.Files.Storage.Storage|string storage * @param bool isAvailable * @throws .RuntimeException */ public Storage(OC.Files.Storage.Storage storage, bool isAvailable = true) { this.storageId = storage.getId(); this.storageId = adjustStorageId(this.storageId); if (row = self::getStorageById(this.storageId)) { this.numericId = (int)row["numeric_id"]; } else { connection = .OC::server.getDatabaseConnection(); available = isAvailable ? 1 : 0; if (connection.insertIfNotExist("*PREFIX*storages", ["id" => this.storageId, "available" => available]) ) { this.numericId = (int)connection.lastInsertId("*PREFIX*storages"); } else { if (row = self::getStorageById(this.storageId)) { this.numericId = (int)row["numeric_id"]; } else { throw new.RuntimeException( "Storage could neither be inserted nor be selected from the database"); } } } }
public Propagator(Files.Storage.Storage storage, IDBConnection connection, IList <string> ignores) { this.storage = storage; this.connection = connection; this.ignores = ignores; }