Results 1 to 10 of 10

Thread: Contao 3 filemanager

  1. #1

    Default Contao 3 filemanager

    In the past (before contao3) I was able to present a folder to the front end users with daily reports automatically generated. How can I automaticlly sync every morning the folders so that my files are picked-up?

    thx

  2. #2
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Contao 3 filemanager

    I think you need cron. There is an extension called cron or you can setup real cron at the server.

    There is a description in this blog how to use cron: http://blog.qzminski.com/2010/05/how-to ... ur-module/

    Module config
    First of all we need to assign a task to the TYPOlight cron. This is done in module’s config file. Open the config/config.php and add:

    Code:
    /**
     * Cron jobs
     */
    $GLOBALS['TL_CRON']['daily'][] = array('LeagueTable', 'getData');
    Cron tasks can be executed either hourly, daily or weekly. In the array we specify the php class and function that will be executed.

    Get the data
    The LeagueTable.php contains following:

    Code:
    <?php
    
    class LeagueTable extends Frontend
    {
    
      public function getData()
      {
        // curl_init
        // regexp & DOM
        $this->Database->prepare("UPDATE tl_leagueinfo SET tstamp=?, table_info=?, WHERE id=1")->execute(time(), $arrTable);
      }
    
    }
    
    ?>
    There are two important things here. The function you execute has to be public, but that’s obvious.

    Secondly, the class has to extend Frontend! At the first, I have put this method into the ModuleLeagueTable class which extends Module. That was a mistake, because cron job will not execute unless its class extends Frontend.

    Also, if you use a modified frontend template fe_*.tpl, do not forget to put the

    Code:
    [img]<?php echo $this->base; ?>cron.php[/img]
    Or your code won’t be executed
    This description assumes the Contao cron. You need some adjustments to use a real cron. Easiest is to open cron.php with the real cron on the shortest timespan you require and let Contao handle what and when.

  3. #3

    Default Re: Contao 3 filemanager

    Thanx for the answer, but i know I can schedule tasks via cron but the problem is the new file sync script in contao3.
    Only file synced with the sync script are displayed in the front-end. This means I woul need to click evry day on the sync script to have the files displayed

  4. #4
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Contao 3 filemanager

    Run the sync script through cron

  5. #5

    Default Re: Contao 3 filemanager

    Where is the sync script located?

  6. #6
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Contao 3 filemanager

    It is DC_Folder::sync(). So you have to use/create a DataContainer object that is DC_Folder and call sync(). The sync script in Contao gets ran by the Backend class (Creates the datacontainer at around 253, calls sync at around 424 ($dc->$act()).

  7. #7

    Default Re: Contao 3 filemanager

    thanx!

  8. #8
    New user
    Join Date
    09-24-15.
    Posts
    4

    Default

    Quote Originally Posted by Ruud View Post
    It is DC_Folder::sync(). So you have to use/create a DataContainer object that is DC_Folder and call sync(). The sync script in Contao gets ran by the Backend class (Creates the datacontainer at around 253, calls sync at around 424 ($dc->$act()).
    Hey Ruud can you give a concrete / complete job-script? I have no clue about php and would like to run a cronjob that simulates the synchronisation button in the filemanager system.

    I would be very thankful if someone could help me out.

    Nick

  9. #9
    New user
    Join Date
    09-24-15.
    Posts
    4

    Default

    Quote Originally Posted by freeyland View Post
    thanx!

    Hey freeyland can you give a concrete / complete job-script? I have no clue about php and would like to run a cronjob that simulates the synchronisation button in the filemanager system.

    I would be very thankful if someone could help me out.

    Nick

  10. #10
    New user
    Join Date
    09-24-15.
    Posts
    4

    Default running filesync

    I tried to do it like that (stupid as I am):

    path to script: system/bin/filesync

    but that didn't work.
    How can I do that?

    Nick

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •