2

I have installed Drupal 7 in FTP server. I am trying to apply a Drupal patch.

I did see many links online but no one shows how to do it while Drupal is in FTP server of the hosting account. I think there are many ways I can do it. One way would be to get the Net Beans. I am not sure whether I need to install Net Beans in FTP server first or install to my local machine.

If you could provide some details for beginner, it would be helpful.

3
  • Most user apply patch with Git commands, but you also can do it manually.
    – CocoSkin
    Apr 29, 2015 at 18:33
  • Lot of information here. Thanks. I will definitely use all of these info and try my best.
    – autop
    Apr 29, 2015 at 19:55
  • 1
    In general, it's good practice to do as little as possible on your FTP server. Try to think of your FTP server as a shopping window: you only put things there that are finished and ready to be seen by your audience. Develop your site on your local machine. Keep a copy on your local machine, preferably using a version control system like git. All software you use to do these tasks is installed locally. When you're done, push it to your web server. Oct 2, 2015 at 8:26

4 Answers 4

7

If you're on UNIX based system (e.g. MacOSX, various Linux distros), the patch utility is a great tool here. I typically use the command:

patch -p1 < patch-file.patch

With the -p1 option being important for installs already under a git repo.

It sounds like your use case is a bit different though. drupal.org has a good documentation page for applying patches in various environments.

3

There is a perfect tutorial in Applying patches with Git. There is also a simpler way to do this manually. as an example This patch fixes Ctools error. This is the code

diff --git a/includes/css-cache.inc b/includes/css-cache.inc
index d88160b..607b886 100644
--- a/includes/css-cache.inc
+++ b/includes/css-cache.inc
@@ -10,6 +10,12 @@ class CToolsCssCache implements DrupalCacheInterface {
   /**
    * {@inheritdoc}
    */
+  function __construct($bin) {
+  }
+
+  /**
+   * {@inheritdoc}
+   */
 public function clear($cid = NULL, $wildcard = FALSE) {
 // Only clear the caches if the wildcard is set, this ensures that the cache
 // is only cleared when the full caches are cleared manually (eg by invoking

the /includes/css-cache.inc determines the file that needs to be modified. the + sign is the code that should be added and the - sign means the codes that need to be removed (there is non in here). so as a result in this patch, you need to look for public function clear($cid = NULL, $wildcard = FALSE) { statement and insert the

 function __construct($bin) {
 }

above it. clearly this line is in class CToolsCssCache implements DrupalCacheInterface class.

If there is any difficulty for you to install the patch, just modify the files as I said and check if the error has gone.

2

Apply the patch on your local machine using the excellent documentation mentioned above, then FTP the changed files up.

I really hope you are using some sort of versioning system somewhere during all of this. Frankly, I wouldn't accept a server setup where I was still using FTP to move around code files.

1

Yet another approach is to use the Patch Manager module. Here is an excerpt from its project page:

... provides a developer tool for managing patches to core and contributed modules.

As a variation, here are other options to consider (mentioned on the same project page also): Possibly better solution is to use Drush to apply patches (see its make command) or Drush extension Drush Issue Queue Commands because they don't rely on insecure configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.