Day: 5th April 2018

Tine 2.0

Tine 2.0 – #2 The Update

Many problems occur during an update, here I’ll show you my workflow.

Some basic rules:

  1. Backup your database before updating, if there goes something wrong, there is a way back.
  2. Backup your files directory, since 2017 Tine 2.0 stores there internals as well as your files.
  3. Keep your old source until you’ve verified your new Tine 2.0, it’s easier to switch back if you keep did that.

That’s how my structure looks like: is a link to the latest Tine 2.0 source and as you see it’s actually pointing to 2018.02.1, but I’d like to update to 2018.02.2. Unzip the new Tine 2.0 into 2014.09.2 so the index.php is right underneath 2018.02.2.

Use cp /2018.02.1/ /2018.02.2 and cp /2018.02.1/.htaccess /2018.02.2 in case you are using apache2.

Now get into the new sources directory and run php setup.php --update to start the update process. It should output not that much, just which application where updated.

It’s time to publish the new version to the world with ln -sfT /2018.02.2 /

It’s good practise to enable the logging in your while updating to make sure there occured nothing bad.

You’ll probably run into problems with the cache, you could solve this by delete everything inside the caching directory.

For example: rm -rf tine_cache/*!

Have fun and enjoy your Tine 2.0 installation. 🙂

PHP Software Engineering

What is a bitmask?

Saw stuff like error_reporting(E_ERROR | E_WARNING | E_PARSE); or heard about bitmasks and got confused how it actually works? To my shame I never looked it up in like 12 years of programming until now.

What it actually is, is a quite efficient way to define for example grants for a user or which features are enabled for an application. It’s also quite old school but often seen and still in use.

At this point I’d suggest you to also open the PHP documentation where they explain all existing bitwise operators. I created some examples here to make it easier to understand and to visualise what is happening.

So what we’ve learned:

  • We have a 4 bits and we assign a meaning to each of them
  • We can individually switch single bits to express a state
  • Bitwise operations are supposed to be very fast and efficient
  • Use only numbers with a power of 2, otherwise we would mess up the bitmask because the binary system represent a number which is not of the power of 2 by two or more bits
  • Using a bitmask for a simple ACL system and putting each grant into a const might even make it readable and easy to work with

Would I use it? Maybe or maybe not it really depends on what I exactly need. It’s fast and solid when done right but will become messy when it’s getting much more complex. But in case you run into legacy code as I did this might help you to understand it.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.