Categoria: Social-Echo

  • List directories with php and compare them

    Sometimes it’s important to quickly highlight differences between two folders structure.

    It could happen expecially when you are obliged to work on cheap environments, without console and you need to understand if there are differences among your local filesystem and the remote one.

    <?php
    
    $dir = __DIR__;
    $scan_result = scandir( $dir );
    foreach ( $scan_result as $key => $value ) {
      if (!in_array($value, array('.', '..'))) {
        if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
          print $value."<br/>";
        }
      }
    }

    You can copy the script in each directory and naming it scandir.php, than reach it by browser at the url http://path-to-your-base-folder/scandir.php.

    In this way you have just executed the script, do it on each environment directory and occasionally compare them.

    To compare there are Notepad++, git diff, WinMerge and plenty of open source tools.

    Scandir is a php function, check it, I have wrote this code using an example I found there.

  • Il buono il brutto il cattivo ed il gatto!

    Il buono il brutto il cattivo ed il gatto!

    Il buono, il brutto, il cattivo ed il gatto.
    The Good, the Bad and the Ugly.

    L’immagine si commenta da se.

    ilbuonoilbruttoilcattivoeilgatto

    Condividetela copiando questo link: https://blog.unmoscerinonelweb.com/wp-content/uploads/2016/12/ilbuonoilbruttoilcattivoeilgatto.gif

     

  • Altering ECK save message

    Altering ECK save messages is now possible thanks to these hooks:

    hook_eck_entity_save_message_alter
    hook_eck_bundle_save_message_alter

    defined in eck.api.php.

    I strongly suggest you to check that file because is full of interesting hooks that allow developers to customize eck standard (and horrible) behavior.

    Enjoy!