drupal-6


How can you safely add a dependency to a Drupal module?


I have a new version of a Drupal 6 module. In the new version, I have added a new dependency in the .info file to a views utility module I've created called lib_views.
However, lib_views may not be enabled when my module is upgraded. If it's not, then upgrading my module causes an irretrievable crash, because views fires a hook that invokes a function in my un-enabled lib_views module.
Is there any safe way to add a new dependency to an existing Drupal module that can prevent this?
You can force drupal to load the module (it's common practice for CCK modules for example).
Example:
function example_install() {
drupal_load('module', 'content');
content_notify('install', 'example');
}
In the example, drupal_load loads the "content" module first, then content_notify is an example of function that can only be used when the content module is available.
So if the drupal_load call returns FALSE, you can detect that the module is missing and notify the user.
Drupal 7 handles this automatically when going to update.php (which you are suppose to visit after updating a module). I suppose another alternative would be to display a warning message via an update function.

Related Links

Content administer page
Allowing Users to create custom groups of Countries
Drupal: Horizontal Menu
Drupal6 - Export bulk node
Drupal 6 <front>/node lists all nodes (unwanted)
Drupal 6 Syntax Highlighting
Theming node body in Drupal 6
Changing cck fields on content page edit with taxonomy
Using theme functions in custom module
“create a new blog entry” link using views in drupal
Export data into excel sheet - drupal 6
Drupal upgrade 6.20 to 7.0
How to pass multiple arguments to views_embed_view?
Node access for CCK content type
Drupal Pressflow problem with hook_block
Drupal6 - Node import

Categories

HOME
compiler-construction
testing
arduino-uno
openlayers
plone
cplex
react-router
cross-browser
echarts
contact
session-variables
apache-cayenne
seaborn
interop
beyondcompare
opencover
errorlevel
mps
sylius
tapestry
google-search-api
core-text
captiveportal
blazemeter
trading
nhapi
web-api-testing
log4js-node
objectanimator
c++-amp
tasklet
gsmcomm
.net-4.0
asset-pipeline
openoffice.org
scaffold
lto
jna
hue
preconditions
s
.net-4.6.2
rainbowtable
azure-application-gateway
chain-builder
filepicker
dotnetzip
gabor-filter
nstextview
epson
quartz-composer
root-framework
pcf
autorest
angstrom-linux
flash-cs5
simplewebrtc
yaws
system.management
pyke
vhd
teamcity-8.0
fouc
purge
embedded-code
riak-cs
oberon
web-controls
typekit
internet-connection
openexr
starcluster
dml
rebol3
system.net.webexception
typo3-neos
dir
bulkloader
ril
comaddin
eventlistener
broken-links
datawindow
onsubmit
removeclass
bigcouch
ecl
digest-authentication
coda-slider
swing-app-framework
privilege
multiple-languages
caching-application-block
misv

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App