在drupal语言中:grep和pipe – 列出所有发现以避免开销和服务器性能问题

由于安装drupal-commons(这是一个安assembly置文件),我有一个严重的服务器性能警告,我现在想减less服务器负载。 为什么 – 当我尝试安装drupal commons的时候收到一条消息:太多的文件 – 打开它说! 那么Drupal和模块(AB)使用太多的文件! 50,000个最大的文件,也许5000个目录是他们的目标,这是什么,他们只是备份所以它在我的问题:我怎样才能摆脱所有这些愚蠢的翻译文件或任何微小的信息和不必要的细分部分; 我如何摆脱他们!

背景:在安装(或引导程序循环)期间,我希望file_exists()是最昂贵的内置PHP函数,它测量的是在单个请求中调用所有调用函数的总时间。

那么现在我试着摆脱所有的开销(尤其是所谓的翻译文件 – po-文件) – 以及包含在drupal-commons 6.x-2.3中的不必要的文件,以使其运行在我的服务器上。

我想摆脱所有这些愚蠢的翻译文件或任何微小的信息和不必要的细分部分;

如何search所有这些.po文件recursion – 与GREP我猜.. :我现在不在哪里,他们是!

linux-vi17:/home/martin/web_technik/drupal/commons_3_jan_12/commons-6.x-2.3/commons-6.x-2.3 # lsCHANGELOG.txt ._.htaccess install.php modules themes ._CHANGELOG.txt ._includes INSTALL.txt ._profiles ._update.php COMMONS_RELEASE_NOTES.txt includes ._INSTALL.txt profiles update.php ._COMMONS_RELEASE_NOTES.txt ._index.php LICENSE.txt ._robots.txt UPGRADE.txt COPYRIGHT.txt index.php ._LICENSE.txt robots.txt ._UPGRADE.txt ._COPYRIGHT.txt INSTALL.mysql.txt MAINTAINERS.txt ._scripts ._xmlrpc.php ._cron.php ._INSTALL.mysql.txt ._MAINTAINERS.txt scripts xmlrpc.php cron.php INSTALL.pgsql.txt ._misc ._sites .directory ._INSTALL.pgsql.txt misc sites .htaccess ._install.php ._modules ._themes linux-vi17:/home/martin/web_technik/drupal/commons_3_jan_12/commons-6.x-2.3/commons-6.x-2.3 # grep .po 

任何方式我想删除所有.po文件与一个bash命令 – 这是可能的

但等等:首先 – 我想找出所有的文件 – 倪想列出它: – 因为我知道我(rease(/或删除)

那么在Drupal中所有的语言翻译都是用.po –

如何用GREPfind它们? 如何列出它们 – 随后 – 如何擦除它们?

更新:我做了search

 find -type f -name "*.po" 

。 以及我发现大约930个文件。

之后我删除了所有的

 6.x-2.3 # find -type f -name "*.po" -exec rm -f {} \; 

与代码的最后的serach

 find -type f -name "*.po" 

没有结果,所以每个po文件被删除!

非常感谢提示。

问候零

如果要在名为/some/directory的目录中查找名为*.po所有文件,可以使用find

 find /some/directory -type f -name "*.po" 

如果你想连续删除它们(你有备份,不是吗?),然后附加一个动作到这个命令:

 find /some/directory -type f -name "*.po" -exec rm -f {} \; 

用适当的值替换/some/directory ,你应该被设置。

“打开文件太多”的问题通常不是因为文件系统中的文件太多,而是因为应用程序或用户一次可以打开的文件数量有限。 这个问题已经在drupal论坛上讨论过,例如,看到这个线程更加永久/很好地解决它:

http://drupal.org/node/474152

关于打开文件的更多链接:
http://www.cyberciti.biz/tips/linux-procfs-file-descriptors.html
http://blog.thecodingmachine.com/content/solving-too-many-open-files-exception-red5-or-any-other-application