Giới thiệu hàm rmdir sucks trong Drupal 8

Giới thiệu hàm rmdir sucks trong Drupal 8

Drupal 8 & Composer

>> Nhìn lại các phiên bản Versioning trong Drupal

During my work with Drupal 8 & Composer I created a PHP scrip that runs after Composer’s autoload dump. This does many things, such as setup settings.php, move some files and setup a local vagrant environment. As part of the Composer process for Drupal I end up with two vendor directories (long story) so I wanted to add something to this PHP script to delete the vendor directory. The obvious choice is rmdir, but it doesn’t work recursively, which is when I found the example below.

function rrmdir($dir) {
  foreach(glob($dir . '/{,.}*', GLOB_BRACE) as $file) {
    if(is_dir($file)) rrmdir($file); else unlink($file);
  } rmdir($dir);
}

You’ll notice this is looking through all directories, all sub-directories, ell sub-sub-directories, etc. This seemed to work well until I hit the following error:

glob(): Pattern exceeds the maximum allowed length of 1024 characters

This is the point I gave up, decided I had beter thing to procrastinate over and wen’t with passthrucontaining rm -rfto delete the duplicate vendor directory.

Bạn thấy bài viết này như thế nào?: 
Average: 5 (1 vote)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
HTC ChaCha Review

HTC ChaCha Review

The HTC ChaCha is definitely a new generation smart phone that is facebook focused, probably as a result of the fact that mobile phone manufacturers have realized that social networking is a great selling point.

Bán con bò nào ngân hàng siết nợ luôn thì làm sao sống nổi

Bán con bò nào ngân hàng siết nợ luôn thì làm sao sống nổi

Được biết, sau khi bàn bạc nhiều phương án và đi đến quyết định cuối cùng, tại ĐHĐCĐ bất thường diễn ra vào ngày 8/1/2021

 Cấu hình Web Server trên Windows server 2003

Cấu hình Web Server trên Windows server 2003

Web Server là máy chủ có dung lượng lớn, tốc độ cao, được dùng để lưu trữ thông tin như một ngân hàng dữ liệu, chứa những website đã được thiết kế cùng với những thông tin liên quan khác. (các mã Script, các chương trình, và các file Multimedia)

Công ty diệt chuột T&C

 

Diet con trung