本文整理汇总了PHP中CFileHelper::removeDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileHelper::removeDirectory方法的具体用法?PHP CFileHelper::removeDirectory怎么用?PHP CFileHelper::removeDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileHelper
的用法示例。
在下文中一共展示了CFileHelper::removeDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
$filePath = $this->getTestFilePath();
if (file_exists($filePath)) {
FileHelper::removeDirectory($filePath);
}
}
示例2: up
public function up()
{
CFileHelper::removeDirectory(Yii::app()->basePath . "/components/dashboard/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../update/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../assets/lib/chosen/");
$this->update('openformat', array("export" => "this.reg_date", "import" => 'this.reg_date'), "id='1362'");
}
示例3: up
public function up()
{
CFileHelper::removeDirectory(Yii::app()->basePath . "/components/dashboard/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../update/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../assets/lib/chosen/");
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->alterColumn($company->prefix . 'itemCategories', "id", 'INT(11) NOT NULL AUTO_INCREMENT');
}
}
示例4: up
public function up()
{
//return false;
//$this->update( 'menu', array("url"=>"newUpdate"), "id=64");
CFileHelper::removeDirectory(Yii::app()->basePath . "/components/dashboard/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../update/");
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->delete($company->prefix . 'docDetails', "iItem=0 AND qty=0 AND iTotal=0 AND ihTotal=0");
}
}
示例5: up
public function up()
{
CFileHelper::removeDirectory(Yii::app()->basePath . "/components/dashboard/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../update/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../assets/lib/chosen/");
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->addColumn($company->prefix . 'docDetails', 'iTotalVat', 'decimal(20,2) NOT NULL');
$this->update($company->prefix . 'config', array("value" => "2"), "id='company.precision'");
$this->update($company->prefix . 'docDetails', array("iTotalVat" => new CDbExpression("`iTotal`*(1+`iVatRate`/100)")), "1=1");
}
}
示例6: up
public function up()
{
CFileHelper::removeDirectory(Yii::app()->basePath . "/components/dashboard/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../update/");
CFileHelper::removeDirectory(Yii::app()->basePath . "/../assets/lib/chosen/");
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->addColumn($company->prefix . 'mail', 'sent', 'int(11) NOT NULL');
$this->insert($company->prefix . 'config', array("id" => "company.sumDiff", "value" => 0.05, "eavType" => "string", "hidden" => 1, "priority" => 40));
$this->insert($company->prefix . 'config', array("id" => "company.precision", "value" => 1, "eavType" => "integer", "hidden" => 1, "priority" => 40));
}
}
示例7: actionIndex
public function actionIndex()
{
$dir = Yii::getPathOfAlias('webroot') . '/uploads/partner/';
CFileHelper::removeDirectory($dir);
if (is_dir($dir) == false) {
CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode']);
}
$dir = Yii::getPathOfAlias('webroot') . '/assets/thumbs/';
CFileHelper::removeDirectory($dir);
if (is_dir($dir) == false) {
CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode']);
}
}
示例8: setUp
protected function setUp()
{
$this->sassHandler = new SassHandler();
$this->sassHandler->compilerPath = __DIR__ . '/../vendor/leafo/scssphp/scss.inc.php';
// Use "compressed" formatting to simplify code with assertions
$this->sassHandler->compilerOutputFormatting = SassHandler::OUTPUT_FORMATTING_COMPRESSED;
$this->fixturesDirectory = __DIR__ . '/fixtures/';
// Cleanup
$compiledDirectory = Yii::getPathOfAlias($this->sassHandler->sassCompiledPath);
if (is_dir($compiledDirectory)) {
CFileHelper::removeDirectory($compiledDirectory);
}
}
示例9: afterUninstall
public function afterUninstall()
{
Yii::app()->settings->clear('shop');
Yii::app()->unintallComponent('currency');
$db = Yii::app()->db;
$tablesArray = array(ShopTypeAttribute::model()->tableName(), ShopAttribute::model()->tableName(), ShopAttributeOption::model()->tableName(), ShopAttributeOptionTranslate::model()->tableName(), ShopAttributeTranslate::model()->tableName(), ShopCategory::model()->tableName(), ShopCategoryTranslate::model()->tableName(), ShopCurrency::model()->tableName(), ShopManufacturer::model()->tableName(), ShopManufacturerTranslate::model()->tableName(), ShopProduct::model()->tableName(), ShopProductCategoryRef::model()->tableName(), ShopProductImage::model()->tableName(), ShopProductTranslate::model()->tableName(), ShopProductType::model()->tableName(), ShopProductVariant::model()->tableName(), ShopRelatedProduct::model()->tableName(), ShopSuppliers::model()->tableName(), $db->tablePrefix . 'shop_product_attribute_eav', $db->tablePrefix . 'shop_product_configurable_attributes', $db->tablePrefix . 'shop_product_configurations');
foreach ($tablesArray as $table) {
$db->createCommand()->dropTable($table);
}
CFileHelper::removeDirectory(Yii::getPathOfAlias('webroot.uploads.product'), array('traverseSymlinks' => true));
CFileHelper::removeDirectory(Yii::getPathOfAlias('webroot.uploads.categories'), array('traverseSymlinks' => true));
CFileHelper::removeDirectory(Yii::getPathOfAlias('webroot.uploads.manufacturer'), array('traverseSymlinks' => true));
return parent::afterUninstall();
}
示例10: deleteModelDir
/**
* Delete the whole directory on delete.
*/
protected function deleteModelDir()
{
CFileHelper::removeDirectory($this->folderPath);
}
示例11: deleteModelDir
public function deleteModelDir()
{
// Delete folder and all files on it.
$dir = Yii::getPathOfAlias('webroot') . '/uploads/user/' . $this->id;
CFileHelper::removeDirectory($dir);
}
示例12: testRemoveDirectorySymlinks2
public function testRemoveDirectorySymlinks2()
{
if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
$this->markTestSkipped('Cannot test this on MS Windows since symlinks are uncommon for it.');
}
$ds = DIRECTORY_SEPARATOR;
$td = $this->testDir . $ds;
$this->createSymlinkedDirectoriesAndFiles();
CFileHelper::removeDirectory($td . 'symlinks', array('traverseSymlinks' => true));
$this->assertTrue(!is_dir($td . 'symlinks'));
$this->assertTrue(is_file($td . 'file'));
$this->assertTrue(!is_link($td . 'symlinks' . $ds . 'symlink-file'));
$this->assertTrue(is_dir($td . 'directory'));
$this->assertTrue(!is_file($td . 'directory' . $ds . 'directory-file'));
// file inside symlinked dir was deleted
$this->assertTrue(!is_link($td . 'symlinks' . $ds . 'symlink-directory'));
$this->assertTrue(!is_file($td . 'symlinks' . $ds . 'symlink-directory' . $ds . 'directory-file'));
}
示例13: actionUpload
public function actionUpload()
{
if ($_FILES['PDFUpload']['error']['pdf'] === 0) {
$tempFolder = tempnam("/tmp", "DAPUS_");
unlink($tempFolder);
mkdir($tempFolder);
$model = new PDFUpload();
$model->attributes = $_POST['PDFUpload'];
$model->pdf = CUploadedFile::getInstance($model, 'pdf');
if ($model->validate()) {
$uploaded = $model->pdf->saveAs($tempFolder . '/input.pdf');
if ($uploaded) {
$g = new Grobid();
$g->setGrobidJar(Yii::app()->params['grobidPath'] . 'grobid-core/target/grobid-core-0.3.3-SNAPSHOT.one-jar.jar');
$g->setGrobidHome(Yii::app()->params['grobidPath'] . 'grobid-home/');
$g->setIn($tempFolder);
$g->setOut($tempFolder);
$g->setProcess('processHeader');
$grobidResult = $g->run();
list($g_doi, $g_title) = StringHelper::parseGrobid($grobidResult);
if ($g_doi !== '') {
$reference = WebAPI::searchCrossRefDOI($g_doi);
} else {
if ($g_title !== '') {
$reference = WebAPI::searchCrossRef($g_title);
} else {
throw new CHttpException(500, "Tidak ditemukan hasil");
}
}
// save to database
$submission = new Submission();
$submission->timestamp = new CDbExpression('NOW()');
$submission->object = serialize($reference);
$submission->oid = sha1($submission->object);
$submission->ref_type = $reference->type;
if ($submission->save()) {
$this->redirect(array('site/result/' . $submission->oid));
} else {
throw new CHttpException(500, "Kesalahan: Gagal menyimpan data.");
}
} else {
CFileHelper::removeDirectory($tempFolder);
throw new CHttpException(500, "Upload gagal dengan kode error: {$model->pdf->getError()}.");
}
} else {
CFileHelper::removeDirectory($tempFolder);
throw new CHttpException(500, "Kesalahan dokumen (harus PDF).");
}
// cleanup
CFileHelper::removeDirectory($tempFolder);
} else {
$this->redirect(array('site/index'));
}
}
示例14: delete
public function delete()
{
//delete tables
$connection = Yii::app()->db;
//get connection
$dbSchema = $connection->schema;
//or $connection->getSchema();
$tables = $dbSchema->getTableNames();
//returns array of tbl schema's
foreach ($tables as $tbl) {
if (strpos($tbl, $this->prefix) === 0) {
//echo $tbl->rawName, ":<br/>", implode(', ', $tbl->columnNames), "<br/>\n";
//$dbSchema->dropTable($tbl);
$command = $connection->createCommand($dbSchema->dropTable($tbl));
$command->execute();
// execute the non-query SQL
//echo "holyshit:". $tbl . "<br/>\n";
}
}
//delete folders
$folder = $this->getFilePath($this);
CFileHelper::removeDirectory($folder);
//delete db perms
return parent::delete();
}
示例15: testRemoveDirectory
public function testRemoveDirectory()
{
$this->createTestStruct($this->testDir);
$ds = DIRECTORY_SEPARATOR;
$bd = $this->testDir . $ds;
$this->assertTrue(is_dir($bd . $this->rootDir1));
$this->assertTrue(is_dir($bd . $this->rootDir1 . $ds . $this->subDir));
$this->assertFalse(is_dir($bd . $this->rootDir2));
$this->assertTrue(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file1));
$this->assertTrue(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file2));
$this->assertTrue(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file3));
$this->assertFalse(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file4));
CFileHelper::removeDirectory($bd . $this->rootDir2);
$this->assertTrue(is_dir($bd . $this->rootDir1));
$this->assertTrue(is_dir($bd . $this->rootDir1 . $ds . $this->subDir));
$this->assertFalse(is_dir($bd . $this->rootDir2));
$this->assertTrue(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file1));
$this->assertTrue(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file2));
$this->assertTrue(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file3));
$this->assertFalse(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file4));
CFileHelper::removeDirectory($bd);
$this->assertFalse(is_dir($bd . $this->rootDir1));
$this->assertFalse(is_dir($bd . $this->rootDir1 . $ds . $this->subDir));
$this->assertFalse(is_dir($bd . $this->rootDir2));
$this->assertFalse(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file1));
$this->assertFalse(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file2));
$this->assertFalse(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file3));
$this->assertFalse(is_file($bd . $this->rootDir1 . $ds . $this->subDir . $ds . $this->file4));
}