
Advanced search
Medias (1)
-
Bug de détection d’ogg
22 March 2013, by
Updated: April 2013
Language: français
Type: Video
Other articles (62)
-
Le profil des utilisateurs
12 April 2011, byChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 November 2010, byAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 May 2011, byDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
On other websites (4047)
-
How to create a scheduled task – Introducing the Piwik Platform
28 August 2014, by Thomas Steur — DevelopmentThis is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to create a custom theme in Piwik). This time you’ll learn how to execute scheduled tasks in the background, for instance sending a daily email. For this tutorial you will need to have basic knowledge of PHP.
What can you do with scheduled tasks?
Scheduled tasks let you execute tasks regularly (hourly, weekly, …). For instance you can:
- create and send custom reports or summaries
- sync users and websites with other systems
- clear any caches
- import third-party data into Piwik
- monitor your Piwik instance
- execute any other task you can think of
Getting started
In this series of posts, we assume that you have already set up your development environment. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik.
To summarize the things you have to do to get setup:
- Install Piwik (for instance via git).
- Activate the developer mode:
./console development:enable --full
. - Generate a plugin:
./console generate:plugin --name="MyTasksPlugin"
. There should now be a folderplugins/MyTasksPlugin
. - And activate the created plugin under Settings => Plugins.
Let’s start creating a scheduled task
We start by using the Piwik Console to create a tasks template:
./console generate:scheduledtask
The command will ask you to enter the name of the plugin the task should belong to. I will simply use the above generated plugin name “MyTasksPlugin”. There should now be a file
plugins/MyTasksPlugin/Tasks.php
which contains some examples to get you started easily:class Tasks extends \Piwik\Plugin\Tasks
{
public function schedule()
{
$this->hourly('myTask'); // method will be executed once every hour
$this->daily('myTask'); // method will be executed once every day
$this->weekly('myTask'); // method will be executed once every week
$this->monthly('myTask'); // method will be executed once every month
// pass a parameter to the task
$this->weekly('myTaskWithParam', 'anystring');
// specify a different priority
$this->monthly('myTask', null, self::LOWEST_PRIORITY);
$this->monthly('myTaskWithParam', 'anystring', self::HIGH_PRIORITY);
}
public function myTask()
{
// do something
}
public function myTaskWithParam($param)
{
// do something
}
}A simple example
As you can see in the generated template you can execute tasks hourly, daily, weekly and monthly by registering a method which represents the actual task:
public function schedule()
{
// register method remindMeToLogIn to be executed once every day
$this->daily('remindMeToLogIn');
}
public function remindMeToLogIn()
{
$mail = new \Piwik\Mail();
$mail->addTo('me@example.com');
$mail->setSubject('Check stats');
$mail->setBodyText('Log into your Piwik instance and check your stats!');
$mail->send();
}This example sends you an email once a day to remind you to log into your Piwik daily. The Piwik platform makes sure to execute the method
remindMeToLogIn
exactly once every day.How to pass a parameter to a task
Sometimes you want to pass a parameter to a task method. This is useful if you want to register for instance one task for each user or for each website. You can achieve this by specifying a second parameter when registering the method to execute.
public function schedule()
{
foreach (\Piwik\Site::getSites() as $site) {
// create one task for each site and pass the URL of each site to the task
$this->hourly('pingSite', $site['main_url']);
}
}
public function pingSite($siteMainUrl)
{
file_get_contents($siteMainUrl);
}How to test scheduled tasks
After you have created your task you are surely wondering how to test it. First, you should write a unit or integration test which we will cover in one of our future blog posts. Just one hint: You can use the command
./console generate:test
to create a test. To manually execute all scheduled tasks you can execute the API methodCoreAdminHome.runScheduledTasks
by opening the following URL in your browser:http://piwik.example.com/index.php?module=API&method=CoreAdminHome.runScheduledTasks&token_auth=YOUR_API_TOKEN
Don’t forget to replace the domain and the token_auth URL parameter.
There is one problem with executing the scheduled tasks: The platform makes sure they will be executed only once an hour, a day, etc. This means you can’t simply reload the URL and test the method again and again as you would have to wait for the next hour or day. The proper solution is to set the constant
DEBUG_FORCE_SCHEDULED_TASKS
to true within the file Core/TaskScheduler.php. Don’t forget to set it back to false again once you have finished testing it.Starting from Piwik 2.6.0 you can alternatively execute the following command:
./console core:run-scheduled-tasks --force --token-auth=YOUR_TOKEN_AUTH
The option “–force” will make sure to execute even tasks that are not due to run at this time. So you won’t have to modify any files.
Which tasks are registered and when is the next execution time of my task?
The TasksTimetable plugin from the Marketplace can answer this question for you. Simply install and activate the plugin with one click by going to Settings => Marketplace => Get new functionality. It’ll add a new admin menu item under Settings named Scheduled Tasks.
Publishing your Plugin on the Marketplace
In case you want to share your task(s) with other Piwik users you can do this by pushing your plugin to a public GitHub repository and creating a tag. Easy as that. Read more about how to distribute a plugin.
Advanced features
Isn’t it easy to create scheduled tasks? We never even created a file! Of course, based on our API design principle “The complexity of our API should never exceed the complexity of your use case.” you can accomplish more if you want. For instance, you can define priorities, you can directly register methods from different objects and classes, you can specify at which time of a day a task should run and more.
Would you like to know more about tasks? Go to our Tasks class reference in the Piwik Developer Zone.
If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.
-
Revision 37011: Un petit test pour voir si ffmpeg2theora est dispo sur le serveur (pour ...
6 April 2010, by kent1@… — LogUn petit test pour voir si ffmpeg2theora est dispo sur le serveur (pour l’utiliser au cas où plus tard)
-
A *hot* Piwik Community Meetup 2015!
10 August 2015, by André Bräkling — CommunityLast weekend I arrived in Germany to attend the Piwik Community Meetup 2015 and now I am in Poland.
The meetup was HOT in every sense! Berlin temperatures reached 35 degrees (celsius), as I finally meet in person several long-time, dedicated Piwik community contributors.
Meetup preparation in Berlin, photo by M. Zawadziński, licensed under CC-BY-SA 4.0
Pictures from the meetup preparation sessions
In the first leg of my trip I was in Berlin to meet Piwik community members to prepare for the 2015 annual Piwik community meetup. These are my notes taken during the meeting at the request of one of my colleagues. I also relayed live on Framasphère, Twitter and IRC.
Community discussion at the meetup, photo by D.Czajka, licensed under CC-BY-SA 4.0
More pictures from the Piwik meetup
This was harder than I expected, as I took notes with my laptop, pictures with my phone, wrote live to social media (using the Android Diaspora Native Web App), and used my laptop to relay on IRC. Going forward this requires better preparation, I was glad I had a few links and pictures ready before hand but it really requires intense focus to achieve this. I am glad presenters were patient when I requested repeating some of the ideas they shared. I am also a bit disappointed not much happened in IRC.
Two day preparation sessions
The discussions and session we had during the two days prior to the meetup are available here.
We gathered in rented apartments in Berlin, this reminded me very much of similar community gatherings and perhaps of BarCamp and, at a much smaller scale, UDS sessions.
Piwik Pizza!, photo by F. Rodríguez, licensed under CC-BY-SA 4.0
A list of ideas of topics was initially submitted, we then proceeded to have scheduled sessions for open discussion. Several people shared their concern there was no possible remote participation which led to making public the Trello boards used/linked here.
Note: The Trello links below still have action items and notes that are pending bug report / feature requests filing which should happen over the coming weeks. Most importantly, many action items will need identifying leads for different community team including Translations and Documentation, and better coordination of coming community engagement.
Monday sessions consisted of the following subjects:
- What are Piwik values & how to communicate them? (see below for details)
- How to encourage and recognize new external contributors?
- How could we double the Piwik userbase?
- How Community can organise help resources
On Tuesday we met again to discuss the following subjects:
- Piwik Long Term support (LTS)
- How do Piwik.org (project) and Piwik PRO (company) sit together / are organized? – An important part of this session was about having better communication channels and improving the new team page (bug #8520 and bug #8519, respectively)
- Improving usability of Piwik e.g. for new users – this last session was not held has we ran out of time and prepared to go to the meetup venue.
Some more details about individual preparation sessions
What are Piwik values & how to communicate them?
The main subjects in this session were important changes proposed in the project mission and values. This was edited directly on on the wiki page on GitHub, some of the changes can be seen by comparing revisions.
Piwik mission statement (bug #7376)
“To create the leading Free and open source analytics platform, and to support global organisations and communities to keep full control over their data.”
Our values
- Openness
- Freedom
- Transparency
- Data ownership
- Privacy
- Kaizen (改善): continuous improvement
This was also presented by Matthieu Aubry at the meetup and is published in the Roadmap page. Bringing more visibility and perhaps having a top page for Mission and Values was also brought up.
Meetup agenda and notes
The official agenda is available here.
Many Piwik PRO employees stayed in Berlin for the meetup, and we had good participation although less than last year in Munich as my colleagues told me. Some were consultants, others staff from public organizations, universities, etc. In retrospect considering the very hot weather and summer holidays the attendance was good. I was very happy to arrive at the beautiful Kulturbrauerei and enter the air-conditioned Soda Club. T-Shirts were waiting for all attendees and free drinks (non-alcohol!) were welcome