Use Access::doAsSuperUser() instead of Piwik::setUserHasSuperUSerAccess which is deprecated.